/* Crossing DOM HUD: base layout (engine lead). The game's CSS sets the custom properties below, best on
   .xh--<game> (the rules dialog carries that class too). Every control is at least 44 x 44 CSS px. */

.xh {
  --xh-font: inherit;
  --xh-font-num: inherit;
  --xh-fg: #f6eedf;
  --xh-muted: #b7a98f;
  --xh-bg: #1d1712;
  --xh-panel: #2a211a;
  --xh-line: rgba(255, 241, 210, 0.14);
  --xh-accent: #ffd36a;
  --xh-good: #7be08f;
  --xh-bad: #ff7a6b;
  --xh-radius: 12px;
  --xh-gap: 12px;
  --xh-cap-size: 64px;
  --xh-cash-glow: 0 0 0 2px rgba(255, 211, 106, 0.55), 0 0 22px rgba(255, 211, 106, 0.45);
  display: grid;
  gap: var(--xh-gap);
  min-width: 0;
  color: var(--xh-fg);
  font-family: var(--xh-font);
  -webkit-tap-highlight-color: transparent;
}
.xh *, .xh-modal * { box-sizing: border-box; }
.xh [hidden], .xh-modal [hidden] { display: none !important; }
.xh-slot { min-width: 0; }
.xh-num { font-family: var(--xh-font-num); font-variant-numeric: tabular-nums; }
.xh-label { display: block; margin: 0 0 6px; color: var(--xh-muted); font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.02em; }
.xh-sr {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------------ shared buttons */
.xh-btn, .xh-diff__opt, .xh-cap, .xh-cash {
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  border: 1px solid var(--xh-line);
  border-radius: var(--xh-radius);
  background: var(--xh-panel);
  color: inherit;
  font: inherit;
  font-weight: 700;
  line-height: 1.1;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.xh-btn:hover:not(:disabled), .xh-diff__opt:hover:not(:disabled) { border-color: var(--xh-accent); }
.xh-btn:disabled, .xh-diff__opt:disabled { cursor: default; opacity: 0.45; }
.xh :focus-visible, .xh-modal :focus-visible { outline: 2px solid var(--xh-accent); outline-offset: 2px; }

/* ------------------------------------------------------------ bet */
.xh-bet__row { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 6px; }
.xh-bet__input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid var(--xh-line);
  border-radius: var(--xh-radius);
  background: var(--xh-bg);
  color: inherit;
  font-size: 1.0625rem;
  font-weight: 700;
  text-align: center;
}
.xh-bet__input[aria-invalid="true"] { border-color: var(--xh-bad); }
.xh-bet__input:disabled { opacity: 0.6; }
.xh-bet__quick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 6px; }
.xh-bet__error { min-height: 1.2em; margin: 4px 0 0; color: var(--xh-bad); font-size: 0.8125rem; }
.xh-bet__error:empty { min-height: 0; margin: 0; }

/* ------------------------------------------------------------ difficulty */
.xh-diff__opts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.xh-diff__opt { padding: 0 4px; font-size: 0.875rem; }
.xh-diff__opt[aria-checked="true"] { border-color: var(--xh-accent); background: var(--xh-bg); color: var(--xh-accent); }
.xh-diff__opt[aria-checked="true"]:disabled, .xh-diff__opt[aria-disabled="true"][aria-checked="true"] { opacity: 1; cursor: default; }
.xh-diff__hint { margin: 6px 0 0; color: var(--xh-muted); font-size: 0.8125rem; }

/* ------------------------------------------------------------ actions: GO/HOP cap and CASH OUT */
.xh-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.xh-cap, .xh-cash {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: max(44px, var(--xh-cap-size));
  padding: 6px 10px;
  background-color: var(--xh-panel);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  font-size: 1.125rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
/* Cap art: the game CSS sets background-image itself, in its own stylesheet, on .xh-cap,
   .xh-cap[data-mode="hop"], :hover, :active and [aria-disabled="true"] (and the same on .xh-cash, plus
   .xh-cash.is-ready). Never put url() in a custom property: browsers resolve it against different
   stylesheets (Chrome against this file), so the image would not be found. */
.xh-cap { background-color: var(--xh-accent); color: var(--xh-bg); border-color: transparent; }
.xh-cap[aria-disabled="true"] { opacity: 0.6; cursor: default; }
.xh-cap[data-mode="busy"] { cursor: progress; }
.xh-cash.is-ready { border-color: var(--xh-accent); box-shadow: var(--xh-cash-glow); }
.xh-cash[aria-disabled="true"] { opacity: 0.5; cursor: default; }
.xh-cash__amt { font-size: 0.8125rem; letter-spacing: 0; text-transform: none; }
.xh-cash__amt:empty { display: none; }
/* Cap art with its own lettering: keep the label for screen readers only. */
.xh-cap--art .xh-cap__label, .xh-cap--art .xh-cash__label, .xh-cap.xh-cap--art .xh-cap__label {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.xh-status { grid-column: 1 / -1; min-height: 1.2em; margin: 0; color: var(--xh-muted); font-size: 0.8125rem; }
.xh-status:empty { min-height: 0; }
.xh-status[data-tone="error"] { color: var(--xh-bad); }
.xh-status[data-tone="good"] { color: var(--xh-good); }
.xh-refill, .xh-retry { grid-column: 1 / -1; }

/* ------------------------------------------------------------ readouts */
.xh-read { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; margin: 0; }
.xh-read__item { min-width: 0; padding: 8px 10px; border: 1px solid var(--xh-line); border-radius: var(--xh-radius); background: var(--xh-bg); }
.xh-read__k { margin: 0; color: var(--xh-muted); font-size: 0.75rem; font-weight: 600; }
.xh-read__v { margin: 2px 0 0; overflow: hidden; font-size: 1rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.xh-read__sub { margin-left: 6px; color: var(--xh-muted); font-size: 0.8125rem; font-weight: 600; }
.xh-read__pays { margin-right: 0.3em; }
/* v1.4.10: the space between a read's parts, there for copied text and screen readers; zero size, so the margins
   above keep the spacing (letter- and word-spacing 0 too: a theme's px spacing would otherwise give it width).
   white-space-collapse: preserve keeps it in the accessibility tree next to an inline-block part (Chrome drops a
   collapsible space there) while wrapping stays the parent's (not the white-space shorthand: pre would stop a
   wrapping parent breaking there, pre-wrap would let a nowrap one break). Older browsers skip it: a plain space.
   A structural utility, so !important: a theme rule on the read's spans (`.xh-read__v span`, `> *`) must not
   give it size. */
.xh-read .xh-read__gap {
  display: inline !important; margin: 0 !important; padding: 0 !important; border: 0 !important;
  font-size: 0 !important; line-height: 0 !important; letter-spacing: 0 !important; word-spacing: 0 !important;
  white-space-collapse: preserve !important;
}
.xh-read__item[data-k="win"] .xh-read__v { color: var(--xh-good); }

/* ------------------------------------------------------------ options */
.xh-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.xh-opt { padding: 0 14px; font-size: 0.875rem; }
.xh-turbo[aria-pressed="true"] { border-color: var(--xh-accent); color: var(--xh-accent); }

/* ------------------------------------------------------------ provably fair (button + DEMO line; details in a dialog) */
.xh-fair__open { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 0 12px; font-size: 0.875rem; }
.xh-fair__badge { display: none; padding: 2px 6px; border-radius: 6px; background: var(--xh-line); font-size: 0.6875rem; letter-spacing: 0.06em; }
.xh-fair__demo { margin: 6px 0 0; color: var(--xh-muted); font-size: 0.75rem; }
/* Smallest layouts: hide the full line and show the badge instead (the dialog always carries the full line). */
.xh-fair--compact .xh-fair__demo { display: none; }
.xh-fair--compact .xh-fair__badge { display: inline-block; }
.xh-fair__row { display: grid; gap: 4px; min-width: 0; margin: 0 0 10px; }
.xh-fair__k { color: var(--xh-muted); font-weight: 600; font-size: 0.8125rem; }
.xh-fair__hash, .xh-fair__seed-old { overflow-wrap: anywhere; word-break: break-all; font-size: 0.75rem; }
.xh-fair__seed { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.xh-fair__client {
  min-width: 0; min-height: 44px; padding: 0 10px; border: 1px solid var(--xh-line); border-radius: var(--xh-radius);
  background: var(--xh-bg); color: inherit; font: inherit;
}
.xh-fair__set { padding: 0 14px; }
.xh-fair__rotate { width: 100%; margin: 0 0 10px; }
.xh-fair__revealed { display: grid; gap: 4px; margin: 0 0 10px; }
.xh-fair__meta { color: var(--xh-muted); overflow-wrap: anywhere; font-size: 0.75rem; }
.xh-fair__error { margin: 0 0 10px; color: var(--xh-bad); }
.xh-fair__error:empty { display: none; }

/* ------------------------------------------------------------ rules dialog */
.xh-modal {
  --xh-fg: #f6eedf; --xh-muted: #b7a98f; --xh-bg: #1d1712; --xh-panel: #2a211a; --xh-line: rgba(255, 241, 210, 0.14);
  --xh-accent: #ffd36a; --xh-radius: 12px;
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(8, 6, 4, 0.66);
  color: var(--xh-fg);
  font-family: var(--xh-font, inherit);
}
.xh-modal__box {
  width: min(560px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  border: 1px solid var(--xh-line);
  border-radius: var(--xh-radius);
  background: var(--xh-panel);
  outline: none;
}
.xh-modal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 8px 0 16px; }
.xh-modal__title { margin: 0; font-size: 1.125rem; }
.xh-modal__close { font-size: 1.5rem; }
.xh-modal__body { padding: 8px 16px 16px; font-size: 0.875rem; line-height: 1.5; }
.xh-modal__body p { margin: 0 0 10px; }
.xh-rules__steps { margin: 0 0 12px; padding-left: 20px; }
.xh-rules__table { width: 100%; margin: 0 0 12px; border-collapse: collapse; font-size: 0.8125rem; }
.xh-rules__table th, .xh-rules__table td { padding: 6px 4px; border-bottom: 1px solid var(--xh-line); text-align: left; }
.xh-rules__table td { text-align: right; }
.xh-rules__table thead th { color: var(--xh-muted); font-weight: 600; }
.xh-rules__table thead th:not(:first-child) { text-align: right; }
.xh-rules__table tr.is-on th { color: var(--xh-accent); }
.xh-rules__demo { color: var(--xh-muted); }

/* ------------------------------------------------------------ v1.4.17 simple layout (theme hud.layout 'simple', D88)
   One column, top to bottom: bet amount (balance on its row), the amount field with half / double / max inside,
   the difficulty dropdown, the next-tile line, GO and CASH OUT at full width, small links.
   Layout rules are plain. Paint (borders, fills, colours, sizes of type) sits in :where(), so the site classes a
   theme adds with hud.classes win over it with no specificity fight; the few rules that must beat this file's own
   base rules above carry .xh--simple. The game CSS skins the rest. */
/* one column that never grows past its box: an input or a nowrap label must not widen the panel */
.xh--simple { grid-template-columns: minmax(0, 1fr); align-content: start; }
/* the word gaps keep read-out names whole ("CASH OUT 12.34"); out of flow, so they never add a flex gap of their own */
.xh--simple .xh-read__gap {
  display: inline !important; position: absolute !important; margin: 0 !important; padding: 0 !important; border: 0 !important;
  font-size: 0 !important; line-height: 0 !important; letter-spacing: 0 !important; word-spacing: 0 !important;
  white-space-collapse: preserve !important;
}
/* named containers, so a game can tighten the bet row and the buttons on a narrow panel (any viewport) */
.xh-bet--simple { container: xh-bet / inline-size; }
.xh-actions--simple { container: xh-act / inline-size; }
.xh-coin { display: inline-block; flex: none; width: 16px; height: 16px; vertical-align: -2px; }
:where(.xh-coin) { border-radius: 50%; background: var(--xh-accent); }

.xh-bet__head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; min-width: 0; margin: 0 0 6px; }
.xh-bet__head .xh-label { margin: 0; }
.xh-bal { display: inline-flex; align-items: center; gap: 4px; min-width: 0; white-space: nowrap; }
:where(.xh-bal) { color: var(--xh-muted); font-size: 0.8125rem; }
:where(.xh-bal__v) { color: var(--xh-fg); font-weight: 700; }
.xh-bet__field { display: flex; align-items: center; gap: 6px; min-width: 0; }
:where(.xh-bet__field) {
  min-height: 52px; padding: 4px 4px 4px 12px; border: 1px solid var(--xh-line); border-radius: var(--xh-radius); background: var(--xh-bg);
}
:where(.xh-bet__field:focus-within) { border-color: var(--xh-accent); }
:where(.xh-bet__field:has(.xh-bet__input[aria-invalid="true"])) { border-color: var(--xh-bad); }
.xh-bet--simple .xh-bet__input {
  flex: 1 1 0; width: 0; min-width: 0; min-height: 44px; padding: 0 4px; border: 0; border-radius: 0; background: transparent;
  text-align: left;
}
.xh-bet--simple .xh-bet__input:focus-visible { outline: none; }
.xh-bet--simple .xh-bet__quick { display: flex; flex: none; gap: 4px; margin: 0; }
:where(.xh-bet--simple .xh-bet__quick .xh-btn) { padding: 0 8px; font-size: 0.8125rem; }

.xh-diff--menu { position: relative; }
.xh-diff--menu.is-open { z-index: 30; }
.xh-diff__btn { display: flex; align-items: center; gap: 8px; width: 100%; }
:where(.xh-diff__btn) { padding: 0 12px; text-align: left; }
:where(.xh-diff__btn:disabled) { opacity: 0.6; }
.xh-diff__name { flex: none; }
:where(.xh-diff__name) { font-weight: 700; }
.xh-diff__meta { min-width: 0; margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:where(.xh-diff__meta) { color: var(--xh-muted); font-size: 0.75rem; font-weight: 600; }
.xh-diff__chev { flex: none; position: relative; width: 12px; height: 12px; }
.xh-diff__chev::before {
  content: ""; position: absolute; left: 2px; top: 1px; width: 6px; height: 6px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg);
}
.xh-diff__list { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0; width: auto; margin: 0; list-style: none; outline: none; }
.xh-diff--menu.is-up .xh-diff__list { top: auto; bottom: calc(100% + 4px); }
:where(.xh-diff__list) {
  padding: 4px; border: 1px solid var(--xh-line); border-radius: var(--xh-radius); background: var(--xh-panel);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}
/* a row: the name and its top multiplier, then the lanes and hit chance on a line of their own */
.xh-diff__item {
  display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; row-gap: 1px; min-height: 44px;
  cursor: pointer; -webkit-user-select: none; user-select: none;
}
:where(.xh-diff__item) { padding: 6px 10px; border-radius: max(2px, calc(var(--xh-radius) - 2px)); }
.xh-diff__item .xh-diff__meta { overflow: visible; }
.xh-diff__sub { flex: 1 0 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:where(.xh-diff__sub) { color: var(--xh-muted); font-size: 0.6875rem; font-weight: 600; }
:where(.xh-diff__item.is-active) { background: var(--xh-bg); }
:where(.xh-diff__item[aria-selected="true"] .xh-diff__name) { color: var(--xh-accent); }

.xh-actions--simple { grid-template-columns: minmax(0, 1fr); gap: 8px; }
.xh-next { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; min-width: 0; margin: 0; }
:where(.xh-next) { color: var(--xh-muted); font-size: 0.8125rem; }
.xh-next__k { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xh-next__v { display: inline-flex; align-items: center; gap: 4px; flex: none; white-space: nowrap; }
.xh-next__x { margin-left: 2px; }
.xh-next.is-none .xh-coin { display: none; }
:where(.xh-next__v) { color: var(--xh-fg); font-weight: 700; }
:where(.xh-next__x) { color: var(--xh-muted); font-weight: 600; }
.xh--simple .xh-cap, .xh--simple .xh-cash { width: 100%; min-height: 52px; flex-direction: row; gap: 10px; }
.xh--simple .xh-cash__amt { font-size: inherit; }

.xh-opts--simple { gap: 4px; }
.xh--simple .xh-link {
  display: inline-flex; align-items: center; gap: 6px; width: auto; min-width: 0; min-height: 44px; padding: 0 8px; border: 0;
  background: none; box-shadow: none; letter-spacing: 0; text-transform: none;
}
:where(.xh--simple .xh-link) { border-radius: var(--xh-radius); color: var(--xh-muted); font-size: 0.8125rem; font-weight: 600; }
:where(.xh--simple .xh-link:hover:not(:disabled)) { color: var(--xh-fg); }
.xh-link__ic { flex: none; width: 18px; height: 18px; }
:where(.xh-link__ic:not(svg)) { border-radius: 4px; background: currentColor; opacity: 0.8; }
:where(.xh-link__ic--svg) { fill: currentColor; }
:where(.xh--simple .xh-turbo.xh-link[aria-pressed="true"]) { color: var(--xh-accent); }
.xh--simple .xh-fair__open { justify-content: flex-start; }
/* no keyboard on a touch-only device: the hotkeys link stays out of the way (the keys still work if one is attached) */
@media (hover: none) and (pointer: coarse) { .xh--simple .xh-keys { display: none; } }
:where(.xh-rules__now) { color: var(--xh-accent); }
.xh-keys__list { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px 14px; margin: 0; }
.xh-keys__list dd { margin: 0; }
.xh-keys__k { white-space: nowrap; }
.xh-keys__k kbd { display: inline-block; min-width: 26px; text-align: center; }
:where(.xh-keys__k kbd) {
  padding: 3px 7px; border: 1px solid var(--xh-line); border-bottom-width: 2px; border-radius: 4px; background: var(--xh-bg);
  color: var(--xh-fg); font: inherit; font-size: 0.75rem; font-weight: 700; line-height: 1.2;
}

@media (prefers-reduced-motion: reduce) {
  .xh *, .xh-modal * { transition: none !important; animation: none !important; }
}
