/* VALBLOX Keno page, on top of styles.css.
   The control panel, inputs, buttons, board well and the result / fairness plates are Mines' components: mines.css
   is imported here (not linked from the page head, so a shell sync that rewrites the head keeps them), which makes
   every game one product. This file adds the Keno parts:
   - the board: a raised iron slab holding 40 octagonal tiles in an 8x5 grid that fills the width of the board well
   - the tiles: the Mines slab construction (true polygon insets, one tone per facet against the top-left light:
     top and top-left +2, top-right +1, bottom-left -1, bottom and bottom-right -2), cut deeper at the corners so they
     read as the octagons on the banner, with bronze numerals. A pick turns the slab frost-blue; a drawn number
     becomes a socket (same walls, inverted normals); a hit turns the whole tile into an aurora-green step-cut gem
     (keno.js draws it as an inline SVG from the tile's size), the number engraved on its table.
   - the paytable row under the board (one chip per hit count, tooltip with the chance) and the recent-draws strip. */
@import url("mines.css");

.keno { width: 100%; }
.keno fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }

/* ---------------------------------------------------------------- panel additions */
.krisk { grid-template-columns: .82fr 1.18fr 1.14fr .86fr; gap: 6px; }   /* room for the longer labels */
.krisk .btn { padding: 0 0 4px; font-size: 13px; letter-spacing: .6px; }
.kpick { clear: both; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.kpick .btn { height: 44px; padding: 0 10px 4px; font-size: 14px; letter-spacing: 1px; --c: 9px; --n: 3px; }
.mpanel[data-state="draw"] .mstart { filter: saturate(.35) brightness(.8); cursor: default; }
#k-instant[aria-pressed="true"] .ic { filter: drop-shadow(0 0 6px rgba(var(--gold-rgb), .45)); }

/* ---------------------------------------------------------------- stage */
.kboard { padding: 16px; }
/* the stage is centred in a cell as tall as the idle well (650 - 2 x 12 - 2 x 16) at the top of the board, so it sits
   where it always did, but an error line that makes the panel (and so the board) taller no longer moves the tiles
   (they went down 14px). The board scrolls into view on phones with a little room below it. */
.keno .mboard { grid-template-rows: minmax(594px, auto); align-content: start; scroll-margin-bottom: 12px; container-type: normal; }
/* the tiles share the board's whole content width, on whole pixels where round() exists, the gap close to 1% of it
   (3px on phones up to 8px), up to the size that keeps the recent strip, the slab and the paytable inside the window's
   height (--tmax, 64 to 120px). The width is --kw, measured by keno.js on the board: a CSS size container would
   restyle every tile on any change inside the board. Until the script runs, --kw0 estimates it from the window
   (the layout's fixed columns and paddings, a desktop scrollbar allowed for). */
.kstage {
  --kw0: calc(100vw - 761px);
  --w: var(--kw, var(--kw0));
  --sp: 12px;   /* slab padding */
  --g: clamp(3px, calc(var(--w) * .0094), 8px);
  --tmax: clamp(64px, calc((100vh - 350px) / 5), 120px);
  --t: min(var(--tmax), calc((var(--w) - 2 * var(--sp) - 7 * var(--g)) / 8));
  width: calc(8 * var(--t) + 7 * var(--g) + 2 * var(--sp)); max-width: 100%;
  display: flex; flex-direction: column; gap: 16px; min-width: 0;
}
@supports (width: round(down, 10.5px, 1px)) {
  .kstage {
    --g: clamp(3px, round(down, calc(var(--w) * .0094), 1px), 8px);
    --t: min(round(down, var(--tmax), 1px), round(down, calc((var(--w) - 2 * var(--sp) - 7 * var(--g)) / 8), 1px));
    /* centred on a whole pixel: an odd leftover would put every tile edge between two pixels */
    justify-self: start; margin-left: max(0px, round(down, calc((var(--w) - 8 * var(--t) - 7 * var(--g) - 2 * var(--sp)) / 2), 1px));
  }
}

/* ---------------------------------------------------------------- recent draws strip */
.khist { display: flex; align-items: center; gap: 14px; min-height: 46px; }
.khist__h { flex: none; font-size: 13px; line-height: 18px; letter-spacing: 1px; color: var(--muted); text-transform: uppercase; }
.khist__list {
  flex: 1; min-width: 0; display: flex; gap: 6px; margin: 0; padding: 0; list-style: none;
  overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain;
}
.khist__list::-webkit-scrollbar { display: none; }
.khist__empty { height: 46px; display: flex; align-items: center; font-family: "Skranji", sans-serif; font-size: 14px; letter-spacing: .4px; color: var(--muted); opacity: .7; }
.khchip {   /* a small recessed plate: multiplier over hits / picks */
  position: relative; isolation: isolate; flex: none; min-width: 58px; height: 46px; padding: 0 9px 2px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  font-family: "Skranji", sans-serif;
}
.khchip > .plate {
  --c: 8px; --n: 3px; --rw: 1px; --rim: var(--rim-iron); --bt: rgba(5, 8, 12, .5); --bb: rgba(var(--hi), .3);
  --face: linear-gradient(180deg, #19202B 0%, #1D2531 100%);
  background: var(--rim);   /* a plain 1px rim: the forged facet rim is for big panels */
}
.khchip__x { font-weight: 700; font-size: 14px; line-height: 18px; letter-spacing: .4px; color: var(--muted); }
.khchip__k { display: flex; align-items: center; gap: 3px; font-size: 11px; line-height: 14px; letter-spacing: .3px; color: var(--muted); opacity: .8; }
.khchip__k img { width: 12px; height: 12px; }   /* the hit gem's own 12px grid */
.khchip.is-win .khchip__x { color: var(--green); }
.khchip.is-win > .plate { --rim: rgba(var(--green-rgb), .34); --face: radial-gradient(90% 80% at 50% 100%, rgba(var(--green-rgb), .1) 0%, rgba(var(--green-rgb), 0) 100%), linear-gradient(180deg, #19202B 0%, #1D2531 100%); }
.khchip.is-part .khchip__x { color: var(--white); }
.khchip.is-zero .khchip__x { opacity: .55; }

/* ---------------------------------------------------------------- board slab */
.kslab { position: relative; isolation: isolate; padding: var(--sp); display: grid; justify-content: center; }
.kslab > .plate {
  --c: 14px; --n: 5px; --bt: rgba(var(--hi), .34); --bb: rgba(var(--lo), .62);
  --face: linear-gradient(180deg, #1F2733 0%, #19202A 100%);
  filter: drop-shadow(0 6px 10px rgba(4, 7, 12, .4));
}

/* ---------------------------------------------------------------- tiles */
.kgrid {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: repeat(8, var(--t)); grid-auto-rows: var(--t); gap: var(--g);
}
.ktile {
  --c: calc(var(--t) * .2);              /* octagon cut, as on the banner tiles */
  --rw: 2px; --ci: calc(var(--c) - var(--rw) * .4142);
  --tt: 3px; --tb: calc(var(--t) * .09); /* top bevel, slab front */
  --rim: #0B0F15;
  --t2: #505E76; --t1: #404D63; --b1: #1F2635; --b2: #181D28;
  --face: linear-gradient(180deg, #37445B 0%, #2C3648 100%);
  position: relative; width: var(--t); height: var(--t); padding: 0; border: 0; background: none; color: inherit;
  font-family: "GoldenSmile", system-ui, sans-serif; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: transform .12s ease-out, opacity .2s ease-out, filter .2s ease-out;
}
@supports (width: round(10.5px, 1px)) {
  .ktile { --c: round(calc(var(--t) * .2), 1px); --tb: round(calc(var(--t) * .09), 1px); }
}
.ktile__plate {
  position: absolute; inset: 0; isolation: isolate; background: var(--rim);
  clip-path: polygon(var(--c) 0, calc(100% - var(--c)) 0, 100% var(--c), 100% calc(100% - var(--c)),
                     calc(100% - var(--c)) 100%, var(--c) 100%, 0 calc(100% - var(--c)), 0 var(--c));
}
.ktile__plate::before, .ktile__plate::after, .ktile::before, .ktile::after { content: ""; position: absolute; inset: var(--rw); pointer-events: none; }
.ktile__plate::before {   /* bevel ring: upper half +2, lower half -2 */
  background: linear-gradient(var(--t2) 0 50%, var(--b2) 50% 100%);
  clip-path: polygon(var(--ci) 0, calc(100% - var(--ci)) 0, 100% var(--ci), 100% calc(100% - var(--ci)),
                     calc(100% - var(--ci)) 100%, var(--ci) 100%, 0 calc(100% - var(--ci)), 0 var(--ci));
}
.ktile__plate::after {    /* face: every edge moved in along its normal (--tt at the top, --tb at the bottom) */
  background: var(--face);
  clip-path: polygon(calc(var(--ci) + var(--tt) * .4142) var(--tt), calc(100% - var(--ci) - var(--tt) * .4142) var(--tt),
                     100% calc(var(--ci) + var(--tt) * 1.4142), 100% calc(100% - var(--ci) - var(--tb) * 1.4142),
                     calc(100% - var(--ci) - var(--tb) * .4142) calc(100% - var(--tb)), calc(var(--ci) + var(--tb) * .4142) calc(100% - var(--tb)),
                     0 calc(100% - var(--ci) - var(--tb) * 1.4142), 0 calc(var(--ci) + var(--tt) * 1.4142));
}
.ktile::before {          /* top-right chamfer bevel (+1) */
  z-index: 1; background: var(--t1);
  clip-path: polygon(calc(100% - var(--ci)) 0, 100% var(--ci), 100% calc(var(--ci) + var(--tt) * 1.4142), calc(100% - var(--ci) - var(--tt) * .4142) var(--tt));
}
.ktile::after {           /* bottom-left chamfer bevel (-1) */
  z-index: 1; background: var(--b1);
  clip-path: polygon(0 calc(100% - var(--ci)), var(--ci) 100%, calc(var(--ci) + var(--tb) * .4142) calc(100% - var(--tb)), 0 calc(100% - var(--ci) - var(--tb) * 1.4142));
}
/* the numeral: raised bronze, lit from the top (flat light upper half falling to the mid tone), with a hard
   2px drop in the darkest bronze for its extruded side */
.ktile__n {
  position: absolute; z-index: 2; left: 0; right: 0; top: calc(50% - (var(--tb) - var(--tt)) / 2); transform: translateY(-50%);
  display: block; text-align: center; pointer-events: none;
  font-size: calc(var(--t) * .4); line-height: 1; letter-spacing: .02em;
  background: linear-gradient(180deg, var(--bz1) 0 45%, var(--bz2) 45% 70%, var(--bz3) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 #4A3312);
  padding-bottom: .06em;
}
@supports (width: round(10.5px, 1px)) { .ktile__n { font-size: round(calc(var(--t) * .4), 1px); } }

.ktile:not([aria-disabled="true"]):hover { transform: translateY(-2px); --rim: #2E4A60; --face: linear-gradient(180deg, #3F4D66 0%, #333E52 100%); --t2: #5B6A84; --t1: #4A5870; }
.ktile:not([aria-disabled="true"]):active { transform: translateY(1px); --tb: calc(var(--tt) + 2px); }
/* keyboard focus traces the octagon: the rim turns lilac, a 1px lilac line and a glow follow the outline (a square
   outline boxed the tile, corners and all); forced colours keep a system outline */
.ktile:focus-visible {
  outline: none; --rim: var(--lilac);
  filter: drop-shadow(1px 0 0 var(--lilac-light)) drop-shadow(-1px 0 0 var(--lilac-light)) drop-shadow(0 1px 0 var(--lilac-light))
          drop-shadow(0 -1px 0 var(--lilac-light)) drop-shadow(0 0 6px rgba(var(--lilac-rgb), .5));
}
@media (forced-colors: active) { .ktile:focus-visible { outline: 2px solid CanvasText; outline-offset: 2px; } }
.ktile[aria-disabled="true"] { cursor: default; }
.kgrid.is-capped .ktile:not(.is-picked) { cursor: not-allowed; }

/* picked: the slab turns frost; numerals engraved in deep navy with a lit lower lip. A hit keeps this slab under its
   gem: it is the face the tile turns away from before the gem comes round */
.ktile.is-picked, .ktile.is-hit {
  --rim: #10283A;
  --t2: #E2F5FE; --t1: #C3E8F9; --b1: #5A9FC7; --b2: #3F7FA9;
  --face: linear-gradient(180deg, #ABDEF6 0%, #8DCFEE 100%);
}
.ktile.is-picked .ktile__n { background: none; color: #15334B; filter: none; text-shadow: 0 1px 0 rgba(226, 245, 254, .6); }
.ktile.is-picked:not([aria-disabled="true"]):hover { --rim: #1D4A66; --face: linear-gradient(180deg, #B8E4F8 0%, #98D5F1 100%); --t2: #EEF9FF; --t1: #CFEEFB; }

/* drawn, not picked: a socket (same walls, inverted normals: top and top-left -2, top-right -1, bottom-left +1,
   bottom +2), dark face, the numeral muted */
.ktile.is-drawn {
  --tt: 4px; --tb: 4px;
  --t2: #0C1017; --t1: #121822; --b1: #2B3547; --b2: #374358;
}
.ktile.is-drawn { --face: linear-gradient(180deg, #141A24 0%, #19212D 100%); }
.ktile.is-drawn .ktile__n { background: none; color: #8592A9; filter: none; text-shadow: 0 -1px 0 rgba(5, 8, 12, .7); }

/* hit: the whole tile is the gem: the tile's own octagon, a dark rim, eight crown facets lit from the top-left around
   a flat table (keno.js, gemSVG). The numeral stays as it was on the slab, same place and size (the table is centred
   on it), engraved in the gem's darkest green with a lit lower lip like a pick's */
.ktile__gem { position: absolute; z-index: 2; inset: 0; pointer-events: none; }
.ktile__gsvg { display: block; width: 100%; height: 100%; }
.ktile__gg { transform-box: view-box; }   /* its transform-origin (its first corner) is set in user units by keno.js */
.ktile.is-hit .ktile__n { z-index: 3; background: none; color: #001D18; filter: none; text-shadow: 0 1px 0 rgba(222, 255, 241, .45); }

/* after the draw: unhit picks keep their colour, dimmed; idle tiles step back while a draw is on the board. Only a
   step back: at .5 / .55 the board turned into a grey wash where a missed pick was hard to find */
.ktile.is-miss { opacity: .8; filter: saturate(.75); }
.ktile.is-quiet { opacity: .7; }

/* ---------------------------------------------------------------- paytable row */
.kpay { position: relative; min-height: 58px; display: grid; align-items: center; }
.kpay__empty { text-align: center; font-family: "Skranji", sans-serif; font-size: 16px; letter-spacing: .64px; color: var(--muted); }
.kpay__empty[hidden], .kpay__row[hidden] { display: none; }
.kpay__row {
  display: flex; gap: 6px; padding: 2px 0; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain;
}
.kpay__row::-webkit-scrollbar { display: none; }
.kpchip {
  flex: 1 0 0; min-width: 54px; height: 56px; padding: 0 6px 3px; flex-direction: column; gap: 2px; cursor: default;
  font-family: "Skranji", sans-serif; text-transform: none; letter-spacing: .3px; --c: 9px; --n: 3px;
}
.kpchip__x { font-weight: 700; font-size: 14px; line-height: 18px; color: var(--white); white-space: nowrap; }
.kpchip__k { display: flex; align-items: center; gap: 3px; font-size: 12px; line-height: 14px; color: var(--muted); }
.kpchip__k img { width: 12px; height: 12px; }
.kpchip.is-zero .kpchip__x { color: var(--muted); opacity: .6; }
.kpchip.is-zero .kpchip__k img { filter: grayscale(1); opacity: .55; }
.kpchip.is-now {   /* the current hit count during and after a draw */
  --rim: rgba(var(--lilac-rgb), .75); --glow: inset 0 0 14px rgba(var(--lilac-rgb), .22);
  --face: linear-gradient(rgba(var(--lilac-rgb), .2) 0%, rgba(var(--lilac-rgb), .04) 100%), var(--raised);
}
.kpchip.is-now:not(.is-zero) .kpchip__x { color: var(--green); text-shadow: 0 0 10px rgba(var(--green-rgb), .35); }
.kpchip:focus-visible { --rim: var(--lilac); }

/* chance tooltip: one shared plate, placed over the hovered or focused chip by keno.js */
.ktip {
  position: absolute; z-index: 6; bottom: calc(100% + 8px); left: 0; width: 196px; padding: 10px 14px 12px; isolation: isolate;
  pointer-events: none; font-family: "Skranji", sans-serif; filter: drop-shadow(0 8px 14px rgba(4, 7, 12, .55));
}
.ktip[hidden] { display: none; }
.ktip > .plate { --c: 9px; --n: 3px; --rw: 1px; --rim: rgba(var(--lilac-rgb), .45); --face: linear-gradient(180deg, #273042 0%, var(--dropdown) 100%); background: var(--rim); }
.ktip dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 3px 14px; margin: 0; font-size: 13px; line-height: 18px; letter-spacing: .3px; }
.ktip dt { color: var(--muted); }
.ktip dd { margin: 0; text-align: right; font-weight: 700; color: var(--white); }
.ktip dd img { display: inline-block; width: 14px; height: 15px; margin: 0 4px -2px 0; }
.ktip .is-win { color: var(--green); }
.ktip::after {   /* the pointer under the plate */
  content: ""; position: absolute; left: var(--ax, 50%); bottom: -6px; width: 12px; height: 7px; margin-left: -6px;
  background: rgba(var(--lilac-rgb), .45); clip-path: polygon(0 0, 100% 0, 50% 100%);
}

/* ---------------------------------------------------------------- result plate (Mines' plate, compact) */
.kresult { min-width: 260px; padding: 20px 24px 22px; gap: 4px; cursor: pointer; }
.kresult .mresult__multi.h-gold { font-size: 38px; line-height: 44px; }
.kresult__hits { font-family: "Skranji", sans-serif; font-size: 14px; line-height: 18px; letter-spacing: .5px; color: var(--muted); }
.kresult.is-part .mresult__multi { color: var(--white); text-shadow: 0 3px 0 rgba(0, 0, 0, .3); }
.kresult.is-part > .plate { --face: radial-gradient(70% 90% at 50% 0%, rgba(150, 161, 182, .14) 0%, rgba(150, 161, 182, 0) 100%), linear-gradient(180deg, #2A3446 0%, #1F2734 100%); }

/* fairness plate: example seeds */
.knote__seeds { width: 100%; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px; margin: 2px 0; text-align: left; }
.knote__seeds dt { font-family: "Skranji", sans-serif; font-size: 12px; line-height: 18px; color: var(--muted); }
.knote__seeds dd { margin: 0; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 11.5px; line-height: 18px; color: var(--lilac-light); word-break: break-all; }

/* ---------------------------------------------------------------- effects */
/* the hit's burst (keno.js, burst): the bloom lies under the tiles (it lights the slab in the gaps around the hit),
   the crystal shards fly over them */
.kfx { position: absolute; inset: 0; z-index: 4; pointer-events: none; overflow: visible; }
.kfx--under { z-index: 0; }
.kfx__bloom, .kfx__shard { position: absolute; display: block; pointer-events: none; }
.kfx__bloom {
  border-radius: 50%; mix-blend-mode: screen;
  background: radial-gradient(closest-side, rgba(180, 252, 218, .55) 0%, rgba(94, 216, 169, .26) 45%, rgba(94, 216, 169, 0) 100%);
}
.kfx__shard { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }   /* a long diamond, its point the way it flies */

/* ---------------------------------------------------------------- second Start, under the board (stacked layouts) */
.kstart-m { display: none; margin-top: 0; }

/* ---------------------------------------------------------------- narrow */
@media (max-width: 1100px) {
  .kboard { padding: 16px; }
  .kstage { --kw0: calc(100vw - 461px); }
}
@media (max-width: 860px) {
  .keno .mboard { grid-template-rows: minmax(0, 1fr); }   /* stacked: the well hugs the stage */
  .kstage { --kw0: calc(100vw - 137px); }
  .kstart-m { display: inline-flex; }
}
@media (max-width: 600px) {
  .kboard { padding: 6px; margin: 0 8px 8px; }   /* 8px: the well's corner cut stays clear of the frame's */
  .kstage { --sp: 6px; gap: 12px; --kw0: calc(100vw - 60px); }
  .kslab > .plate { --c: 10px; --n: 4px; }
  .ktile { --rw: 1.5px; --tt: 2px; }
  .ktile.is-drawn { --tt: 3px; --tb: 3px; }
  .ktile__n { filter: drop-shadow(0 1px 0 #4A3312); }
  .khist { gap: 10px; min-height: 42px; }
  .khist__h { display: none; }
  .khchip { min-width: 54px; height: 42px; }
  .kpay { min-height: 52px; }
  .kpay__row { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent 100%); mask-image: linear-gradient(90deg, #000 85%, transparent 100%); }
  .kpchip { flex: 0 0 auto; min-width: 50px; height: 50px; }
  .kpchip__x { font-size: 13px; }
  .kresult { min-width: 0; width: calc(100% - 24px); padding: 16px 12px 18px; }
  .kresult .mresult__multi.h-gold { font-size: 30px; line-height: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  .ktile { transition: opacity .15s linear; }
  .ktile:not([aria-disabled="true"]):hover, .ktile:not([aria-disabled="true"]):active { transform: none; }
}

/* bets table tabs (assets/js/bets-tabs.js): filtered rows hide; an empty filter says so */
.bets .brows > [hidden], .bets__empty[hidden] { display: none; }
.bets__empty { width: 100%; height: 56px; margin: 0; display: grid; place-items: center; font-family: "Skranji", sans-serif; font-size: 15px; letter-spacing: .6px; color: var(--muted); }
