/* VALBLOX Fjord Run, on top of styles.css, mines.css and assets/crossing/crossing-hud.css.
   The panel, plates, bets table and result plates are the Mines family; the Crossing engine fills the
   [data-xh] slots of the panel and draws the board into #fr-stage. This file sets the HUD skin (site tokens as
   --xh-* properties), sizes the short panel (engine v1.4.17 hud.layout 'simple', D88) and sizes the stage
   (DESIGN.md section 11). */

.frun,
.xh.xh--fjord-run {
  /* HUD skin: valblox tokens, on .frun and on the engine root: crossing-hud.css declares its defaults on .xh itself,
     so .frun alone never reached the form (QA r1). The dialogs are .xh-modal without .xh: see the block below. */
  --xh-font: "Skranji", sans-serif;
  --xh-font-num: "Skranji", sans-serif;
  --xh-fg: var(--chat-name);
  --xh-muted: var(--muted);
  --xh-bg: var(--track);
  --xh-panel: var(--card);
  --xh-line: var(--rim-iron);
  --xh-accent: var(--lilac);
  --xh-good: var(--green);
  --xh-bad: var(--red);
  --xh-radius: 6px;
  --xh-gap: 12px;
}

/* the rules and fair dialogs (.xh-modal, a child of <body>, no .xh class; crossing-hud.css re-declares its tokens on
   .xh-modal): same site tokens, Skranji body, the site's display face on the title (QA r2, UX fix 1) */
.xh-modal.xh--fjord-run {
  --xh-font: "Skranji", sans-serif; --xh-font-num: "Skranji", sans-serif;
  --xh-fg: var(--chat-name); --xh-muted: var(--muted); --xh-bg: var(--track); --xh-panel: var(--card);
  --xh-line: var(--rim-iron); --xh-accent: var(--lilac); --xh-good: var(--green); --xh-bad: var(--red); --xh-radius: 6px;
}
.xh-modal.xh--fjord-run .xh-modal__title { font-family: "GoldenSmile", system-ui, sans-serif; }
.xh-modal.xh--fjord-run .xh-btn {
  background: var(--raised); border-color: var(--btn-border); color: var(--muted);
  font-family: "GoldenSmile", system-ui, sans-serif; font-weight: 400; text-transform: uppercase; letter-spacing: 1px;
}

/* ---------------------------------------------------------------- panel (engine v1.4.17 simple layout, D88)
   Top to bottom: Bet Amount with the balance on its row, the amount field with ½ / 2X / MAX inside it, the
   difficulty dropdown, room, the "Next hop pays" line, GO, CASH OUT, then small links (turbo, rules, hotkeys and
   sound as icons, provably fair named). theme.js hud.classes gives the engine's parts the shell's own classes, the Mines panel's:
   .mlabel / .mbal on the bet row, .minput on the amount field, .btn on the quick keys and the difficulty button,
   .menu on its list, .btn--gold GO, .btn--green CASH OUT. This block only sizes them. */
/* the form is the engine's grid (.xh): the head keeps its height and the body takes the rest of the frame's row,
   so the room between the difficulty and the next-tile line is the board's extra height, not a fixed gap */
.frun .xh--simple { grid-template-rows: auto minmax(0, 1fr); }

/* the engine's base button rules (border, radius, fill, 44 px minimum, weight) load after styles.css: hand those
   parts back to the shell's plate (background is the plate's rim; its faces are the ::before / ::after layers) */
.frun .xh--simple :is(.xh-btn, .xh-cap, .xh-cash).btn {
  min-width: 0; min-height: 0; border: 0; border-radius: 0; background: var(--rim); box-shadow: none; opacity: 1;
  font-family: "GoldenSmile", system-ui, sans-serif; font-weight: 400; line-height: normal;
}
.frun .xh--simple .xh-label { font-size: 16px; font-weight: 400; letter-spacing: .64px; color: var(--muted); }

/* Bet Amount, the balance on its row (.mlabel floats; .minput clears it, as on Mines) */
.frun .xh-bet__head.mlabel { margin: 0 0 8px; }
.frun .xh-bet__head .xh-label { margin: 0; font: inherit; letter-spacing: inherit; }
.frun .xh-bal.mbal { gap: 6px; font-size: 13px; letter-spacing: .5px; }
.frun .xh-bal__v { font-family: "Skranji", sans-serif; }
.frun .xh-coin { width: 16px; height: 17px; border-radius: 0; background: url("assets/img/coin-16.svg") center / contain no-repeat; vertical-align: -3px; }
.frun .xh-bet__coin { width: 20px; height: 21px; background-image: url("assets/img/coin-20.svg"); }
/* the amount field: the shell's recessed .minput, the three quick keys inside it like Mines' mine stepper */
.frun .xh-bet__field.minput { height: 56px; min-height: 0; gap: 10px; padding: 0 6px 0 16px; }   /* Mines' 53 px + room for 44 px keys */
.frun .xh-bet--simple .xh-bet__input { min-height: 0; height: 100%; padding: 0 0 2px; font-family: "Skranji", sans-serif; font-size: 17px; letter-spacing: .7px; color: var(--white); }
.frun .xh-bet--simple .xh-bet__input:disabled { opacity: 1; color: var(--muted); }
.frun .xh-bet__field.minput:has(.xh-bet__input[aria-invalid="true"]) { --rim: var(--red); --glow: inset 0 0 12px rgba(253, 74, 63, .2); }
.frun .xh-bet--simple .xh-bet__quick { gap: 4px; }
.frun .xh-bet--simple .xh-bet__quick .btn { height: 44px; min-width: 44px; padding: 0 10px 4px; font-size: 14px; letter-spacing: 1px; --c: 9px; --n: 3px; }   /* 44 px touch targets (CONTRACT 6.3) */
.frun .xh-bet--simple .xh-bet__quick .btn.xh-bet__half { font-family: "Skranji", sans-serif; font-weight: 700; font-size: 19px; padding-bottom: 3px; }   /* the display face has no ½ */
.frun .xh-bet__error:not(:empty) { margin-top: 6px; font-family: "Skranji", sans-serif; font-size: 13px; color: var(--red); }
/* a narrow panel (a small phone, a split window): the row tightens before anything can clip */
@container xh-bet (max-width: 300px) {
  .frun .xh-bet__field.minput { gap: 6px; padding: 0 6px 0 12px; }
  .frun .xh-bet--simple .xh-bet__input { font-size: 15px; letter-spacing: .3px; }
  .frun .xh-bet--simple .xh-bet__quick { gap: 3px; }
  .frun .xh-bet--simple .xh-bet__quick .btn { padding: 0 7px 4px; font-size: 13px; letter-spacing: .5px; }
  .frun .xh-bet--simple .xh-bet__quick .btn.xh-bet__half { font-size: 17px; }
  .frun .xh-bal.mbal { gap: 4px; font-size: 12px; letter-spacing: .2px; }
}
/* narrower still (a 320 phone): the field's coin gives its room to the amount, so 100,000.00 still fits */
@container xh-bet (max-width: 270px) {
  .frun .xh-bet__coin { display: none; }
}

/* the difficulty dropdown: a raised .btn that opens the shell's .menu plate under it */
.frun .mpanel__body > .xh-slot--difficulty { margin-top: 18px; }
.frun .xh-diff--menu > .xh-label { margin: 0 0 8px; }
.frun .xh-diff__btn.btn { height: 48px; padding: 0 14px 3px 16px; justify-content: flex-start; gap: 10px; color: var(--chat-name); }
.frun .xh-diff__btn.btn:disabled { filter: saturate(.4) brightness(.72); }
.frun .xh-diff--menu.is-open .xh-diff__btn.btn { --rim: rgba(var(--lilac-rgb), .55); color: var(--lilac-light); }
/* depth for the open plate: a drop shadow follows its chamfer (a box shadow would be clipped away) */
.frun .xh-diff--menu.is-open { filter: drop-shadow(0 14px 18px rgba(4, 7, 12, .55)) drop-shadow(0 2px 3px rgba(4, 7, 12, .4)); }
.frun .xh-diff__btn .xh-diff__name { font-size: 15px; letter-spacing: 1.12px; }
.frun .xh-diff__meta { font-family: "Skranji", sans-serif; font-size: 13px; font-weight: 400; letter-spacing: .3px; text-transform: none; color: var(--muted); }
.frun .xh-diff__chev { width: 12px; height: 12px; color: var(--lilac); }
.frun .xh-diff__list.menu { top: calc(100% + 6px); width: auto; padding: 8px; }
.frun .xh-diff--menu.is-up .xh-diff__list.menu { top: auto; bottom: calc(100% + 6px); }
.frun .xh-diff__item {
  min-height: 50px; padding: 7px 12px 8px 14px; border-radius: 0; column-gap: 10px; row-gap: 2px;
  clip-path: polygon(7px 0, calc(100% - 7px) 0, 100% 7px, 100% calc(100% - 7px), calc(100% - 7px) 100%, 7px 100%, 0 calc(100% - 7px), 0 7px);
}
.frun .xh-diff__item .xh-diff__name { font-size: 14px; letter-spacing: 1.12px; text-transform: uppercase; color: var(--lilac); }
.frun .xh-diff__item .xh-diff__meta { color: var(--chat-name); }
.frun .xh-diff__sub { font-family: "Skranji", sans-serif; font-size: 12px; font-weight: 400; letter-spacing: .3px; color: var(--muted); }
/* the row the keys are on: a lilac tint and a lilac edge at its left (an inset ring would break at the chamfers) */
.frun .xh-diff__item.is-active { background: rgba(var(--lilac-rgb), .1); box-shadow: inset 2px 0 0 rgba(var(--lilac-rgb), .75); }
.frun .xh-diff__item.is-active .xh-diff__name { color: var(--lilac-light); }
.frun .xh-diff__item[aria-selected="true"] { background: rgba(var(--gold-rgb), .09); }
.frun .xh-diff__item[aria-selected="true"] .xh-diff__name { color: var(--gold); }

/* room, then the next-tile line, GO and CASH OUT at the foot of the panel (side by side with the board) */
.frun .mpanel__body > .xh-slot--actions { margin-top: auto; padding-top: 22px; }
.frun .xh-actions--simple { gap: 10px; }
.frun .xh-next { align-items: center; min-height: 24px; font-size: 14px; letter-spacing: .4px; }
.frun .xh-next__v { gap: 6px; font-size: 16px; letter-spacing: .5px; color: var(--white); }
.frun .xh-next__x { font-size: 14px; color: var(--lilac-light); }
.frun .xh-next.is-long .xh-next__v { gap: 4px; font-size: 14px; letter-spacing: .2px; }
.frun .xh-next.is-long .xh-next__x { font-size: 12px; }
/* GO / HOP: the shell's gold call to action, as tall as Mines' Start */
.frun .xh--simple .xh-cap.btn { height: 56px; padding: 0 20px 5px; font-size: 18px; letter-spacing: 1.44px; color: var(--gold); text-shadow: none; --c: 12px; --n: 5px; }
.frun .xh--simple .xh-cap.btn[aria-disabled="true"] { filter: saturate(.35) brightness(.8); cursor: default; }
.frun .xh--simple .xh-cap.btn[data-mode="busy"] { cursor: progress; }
/* CASH OUT: a plain raised plate until the round first has something to cash; from that landing to the round's end
   (is-armed, hops included) it is the shell's green plate with the live amount (coin + figure) beside the word, so
   gold GO stays the one lit call to action at rest. Through a hop (not ready for that beat) it only dims a touch. */
.frun .xh--simple .xh-cash.btn { height: 56px; padding: 0 20px 5px; gap: 12px; font-size: 18px; letter-spacing: 1.44px; color: var(--green); --c: 12px; --n: 5px; }
.frun .xh--simple .xh-cash.btn:not(.is-armed) {
  --rw: 1px; --rim: var(--rim-iron); --bt: rgba(var(--hi), .24); --bb: rgba(var(--lo), .56); --face: var(--raised); --glow: none;
  color: var(--muted); filter: none; cursor: default;
}
.frun .xh--simple .xh-cash.btn.is-armed[aria-disabled="true"] { filter: brightness(.86); cursor: default; }
.frun .xh--simple .xh-cash.btn.is-ready { --glow: inset 0 0 26px rgba(var(--green-rgb), .3); }
.frun .xh--simple .xh-cash.btn.is-long { gap: 8px; padding: 0 14px 5px; letter-spacing: 1px; }
.frun .xh--simple .xh-cash.btn.is-long .xh-cash__amt { font-size: 15px; letter-spacing: .3px; }
.frun .xh--simple .xh-cash__amt {
  display: inline-flex; align-items: center; gap: 6px; font-family: "Skranji", sans-serif; font-weight: 700; font-size: 17px;
  letter-spacing: .6px; color: var(--white);
}
.frun .xh--simple .xh-cash__amt:empty { display: none; }
.frun .xh--simple .xh-cash__amt:not(:empty)::before {
  content: ""; width: 18px; height: 19px; flex: none; background: url("assets/img/coin-20.svg") center / contain no-repeat;
}
.frun .xh--simple .xh-status { font-size: 13px; }
.frun .xh--simple .xh-status:empty { display: none; }
.frun .xh--simple :is(.xh-refill, .xh-retry).btn { width: 100%; }
/* a narrow panel: GO and CASH OUT a size down, so the word and a long amount share the row */
@container xh-act (max-width: 280px) {
  .frun .xh--simple :is(.xh-cap, .xh-cash).btn { padding: 0 12px 5px; font-size: 16px; letter-spacing: 1px; }
  .frun .xh--simple .xh-cash__amt { font-size: 15px; }
  .frun .xh-next { font-size: 13px; letter-spacing: .2px; }
  /* the longest line ("1,000,000.00 (1,213.75x)") on a 320 phone: the words step down, the amount keeps its size */
  .frun .xh-next.is-long { font-size: 12px; letter-spacing: 0; }
  .frun .xh-next.is-long .xh-next__v { gap: 3px; letter-spacing: 0; }
  .frun .xh-next.is-long .xh-next__x { font-size: 11px; }
}

/* the small links on one seam at the foot: turbo, rules, hotkeys and the page's sound switch as icons at the left
   (their names stay for screen readers and in their tooltips), "Provably fair" named at the right, and the money's
   own note under them */
.fr-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 0;
  margin: 16px -10px 0; padding-top: 6px; position: relative;
}
.fr-foot::before {
  content: ""; position: absolute; left: 10px; right: 10px; top: 0; height: 2px;
  background: linear-gradient(180deg, var(--rule) 0 1px, rgba(var(--hi), .55) 1px 2px);
}
.fr-foot > .xh-slot, .fr-foot .xh-opts, .fr-foot .xh-fair { display: contents; }
.frun .xh--simple .xh-link { gap: 5px; padding: 0 6px; font-family: "Skranji", sans-serif; font-size: 13px; font-weight: 400; letter-spacing: .4px; color: var(--muted); }
.frun .xh--simple .xh-link:hover:not(:disabled) { color: var(--lilac-light); }
.frun .xh--simple .xh-link:focus-visible { outline: 2px solid var(--lilac-light); outline-offset: -2px; }
.frun .xh--simple .xh-link .xh-link__ic, .frun .fr-sound .ic { width: 18px; height: 18px; }
.frun .xh--simple :is(.xh-turbo, .xh-rules, .xh-keys, .fr-sound).xh-link { min-width: 44px; justify-content: center; padding: 0 6px; }
.frun .xh--simple :is(.xh-turbo, .xh-rules, .xh-keys) .xh-link__t {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.frun .xh--simple .xh-turbo.xh-link[aria-pressed="true"] { color: var(--gold); }
.frun .xh--simple .xh-fair__open.xh-link { order: 2; margin-left: auto; }
.frun .xh--simple .fr-foot .xh-fair__demo {
  order: 3; flex: 1 0 100%; margin: 0 6px 2px; font-family: "Skranji", sans-serif; font-size: 11.5px; line-height: 15px;
  letter-spacing: .3px; color: var(--muted); opacity: .8;
}
.fr-sound .sfx-off, html.sfx-muted .fr-sound .sfx-on { display: none; }
html.sfx-muted .fr-sound .sfx-off { display: block; }

.fr-icon { padding: 0; border: 0; background: none; box-shadow: 0 3px 0 rgba(4, 7, 12, .35); }
.fr-icon img { width: 56px; height: 56px; display: block; }

/* ---------------------------------------------------------------- board */
.fr-board { padding: 14px; min-height: 0; place-items: stretch; }
/* side by side, the well hugs the stage instead of stretching to the panel's height, so no empty band sits under the
   board (UX r3; scoped: in the stacked layout align-self collapses the board) */
@media (min-width: 861px) { .frun .fr-board { align-self: start; } }
.fr-stage {
  position: relative; z-index: 1; min-width: 0; width: 100%;
  height: clamp(300px, 70vh, 640px);    /* 1440x900: s 1.31, lanes about 168 px, the D4.2 target (UX r2-3) */
  clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px), 0 8px);
  background: #0D1A24;
}
.fr-stage > canvas { display: block; width: 100%; height: 100%; outline: none; }
.fr-stage:focus-within { box-shadow: inset 0 0 0 2px var(--lilac); }
.fr-fallback {
  position: relative; z-index: 2; place-self: center; margin: 0; padding: 16px 20px; max-width: 360px; text-align: center;
  font-family: "Skranji", sans-serif; font-size: 15px; line-height: 20px; color: var(--muted);
}

/* phones and tablets (Mines stacks at 860): the board first, then the short panel */
@media (max-width: 860px) {
  .frun .mframe { display: flex; flex-direction: column-reverse; }
  .fr-board { padding: 8px; }
  .fr-stage { height: clamp(250px, 46vh, 420px); }
  .frun .mpanel__body > .xh-slot--actions { padding-top: 16px; }
}
/* tablets and split windows: the stacked panel keeps a readable measure instead of stretching edge to edge */
@media (min-width: 601px) and (max-width: 860px) {
  .frun .mpanel__body { width: 100%; max-width: 520px; justify-self: center; }
  /* the board gives up what CASH OUT needs to end above the fold (about 620 px of bar and panel; 768 x 1024: 404) */
  .fr-stage { height: clamp(250px, calc(100svh - 620px), 420px); }
}
/* phones: a slimmer head and tighter rows, and the board takes what the small viewport (browser bars shown) leaves
   once the site bar and the panel's amount, difficulty, GO and CASH OUT are counted (about 460 px), between 250 and
   420 px. 390 x 844 with no bars: 384 px, CASH OUT ends above the fold. With Safari's bars (about 664 px) the board
   holds its 250 px floor, GO stays in view and CASH OUT sits about 40 px under the fold: a board smaller than 250 px
   is too cramped to play, so that is the trade. */
@media (max-width: 600px) {
  .fr-stage { height: clamp(250px, calc(100svh - 460px), 420px); }
  .frun .xh--simple { row-gap: 0; }
  .frun .mpanel__head { height: 48px; }
  .frun .fr-icon { width: 34px; height: 34px; }
  .frun .fr-icon img { width: 34px; height: 34px; }
  .frun .mpanel__name h1 { font-size: 20px; line-height: 24px; }
  .frun .mpanel__name img { display: none; }
  .frun .mpanel__body { padding-top: 10px; }
  .frun .xh-bet__head.mlabel { margin-bottom: 6px; }
  .frun .mpanel__body > .xh-slot--difficulty { margin-top: 8px; }
  .frun .xh--simple .xh-diff--menu > .xh-label { display: none; }
  .frun .mpanel__body > .xh-slot--actions { padding-top: 10px; }
  .frun .xh-actions--simple { gap: 8px; }
  .frun .xh-next { min-height: 18px; }
  .frun .xh--simple :is(.xh-cap, .xh-cash).btn { height: 48px; }
  .fr-foot { margin-top: 10px; }
}
/* short screens, stacked (320 x 568): the board's floor leaves no room for the whole panel above the fold, so the next
   line, GO and CASH OUT come straight under the board and the bet and difficulty follow (the classic panel's UX r4-3
   rule): a round can always be started without scrolling. Taller phones keep the owner's order. */
@media (max-width: 860px) and (max-height: 600px) {
  .frun .mpanel__body > .xh-slot--actions { order: -1; margin: 0 0 14px; padding-top: 0; }
}

/* the demo note kept clear of the panel's edge */
.frun .xh--simple .fr-foot .xh-fair__demo { margin: 0 16px 2px; }
