.keno-page {
  --keno-panel: #1c3443;
  --keno-board: #0d222e;
  --keno-tile: #233a49;
  --keno-text: #eff9ff;
  --keno-muted: #a8c3d0;
  width: min(100%, 1200px);
  margin-inline: auto;
  padding: clamp(12px, 2vw, 26px) clamp(10px, 1.8vw, 22px) 30px;
  color: var(--keno-text);
}
.keno-page *, .keno-page { box-sizing: border-box; }
.keno-page [hidden] { display: none !important; }
.keno-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.keno-heading h1 { margin: 0; font-size: clamp(24px, 4vw, 34px); line-height: 1.15; }
.keno-back {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid #8cd8f130;
  border-radius: 10px;
  background: #19313f;
  color: #d6f3ff;
}
.keno-back span { font: 30px/1 Arial, sans-serif; translate: 0 -2px; }
.keno-stake-promo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  margin-inline-start: auto;
  padding: 5px clamp(9px, 1.5vw, 15px);
  border: 1px solid #398ff3;
  border-radius: 10px;
  background: #147ce5;
  color: #e1f1ff;
  text-decoration: none;
}
.keno-stake-promo:hover { background: #238bf1; }
.keno-stake-promo img { display: block; width: clamp(104px, 12vw, 140px); height: auto; }
.keno-layout {
  display: grid;
  grid-template-columns: minmax(215px, 255px) minmax(0, 1fr);
  border: 1px solid #8cd8f12a;
  border-radius: 12px;
  overflow: hidden;
}
.keno-controls {
  display: grid;
  align-content: start;
  min-width: 0;
  padding: 12px;
  gap: 6px;
  background: var(--keno-panel);
}
.keno-controls button, .keno-controls input, .keno-controls select, .keno-grid button { font: inherit; }
.keno-controls button, .keno-grid button { cursor: pointer; }
.keno-controls button:disabled { opacity: .57; cursor: default; }
.keno-controls label { color: var(--keno-muted); font-size: 13px; font-weight: 650; margin-top: 7px; }
.keno-controls input, .keno-controls select {
  min-width: 0;
  min-height: 39px;
  padding: 8px 10px;
  border: 1px solid #93c9de36;
  border-radius: 8px;
  background: #132735;
  color: var(--keno-text);
  color-scheme: dark;
}
.keno-controls input { width: 100%; appearance: textfield; }
.keno-controls input::-webkit-inner-spin-button, .keno-controls input::-webkit-outer-spin-button {
  appearance: none;
  margin: 0;
}
.keno-modes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-radius: 24px;
  padding: 4px;
  background: #102530;
}
.keno-modes button {
  min-height: 34px;
  border: 0;
  border-radius: 20px;
  background: transparent;
  color: var(--keno-muted);
  font-size: 13px;
  font-weight: 700;
}
.keno-modes button[aria-pressed="true"] { background: #36596b; color: var(--keno-text); }
.keno-rounds { display: grid; gap: 8px; }
.keno-pick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 7px;
}
.keno-pick-actions button, #keno-play {
  min-height: 40px;
  border: 1px solid #ffffff16;
  border-radius: 8px;
  background: #305266;
  color: var(--keno-text);
  font-size: 13px;
  font-weight: 700;
}
#keno-play { margin-top: 4px; background: #147cdd; color: #fff; }
#keno-play:enabled:hover { background: #0d6ec7; }
.keno-error { margin: 2px 0 0; color: #ffb5b5; font-size: 13px; overflow-wrap: anywhere; }
.keno-error:empty { display: none; }
.keno-board {
  min-width: 0;
  background: var(--keno-board);
  padding: clamp(9px, 1.5vw, 18px);
}
.keno-board-head, .keno-stage { width: min(100%, 676px); margin-inline: auto; }
.keno-board-head {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-block: 0 7px;
}
#keno-sound {
  display: grid;
  place-items: center;
  width: 33px;
  height: 32px;
  padding: 0;
  border: 1px solid #8cd8f130;
  border-radius: 8px;
  background: #19313f;
  color: #d6f3ff;
  cursor: pointer;
}
#keno-sound:hover { background: #254759; }
.keno-stage { position: relative; }
.keno-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: clamp(4px, .75vw, 9px);
  user-select: none;
}
.keno-grid button {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  min-width: 0;
  padding: 0;
  border: 1px solid #a1c4d713;
  border-radius: clamp(5px, 1vw, 10px);
  background: var(--keno-tile);
  color: #f4fbff;
  box-shadow: inset 0 -5px #08192585;
  font-size: clamp(13px, 1.8vw, 21px);
  font-weight: 750;
  transition: background-color .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.keno-grid button:enabled:hover { background: #365968; }
.keno-grid button:enabled:active { transform: translateY(2px); box-shadow: inset 0 -2px #08192566; }
.keno-grid button[aria-pressed="true"] {
  background: #8829e7;
  border-color: #a863ed;
  color: #fff;
  box-shadow: inset 0 -5px #5701a9;
}
.keno-grid:has(.drawn) button[aria-pressed="false"]:not(.drawn) { color: #a4b4bf; }
.keno-grid button.drawn { background: #0b1c25; color: #00e701; box-shadow: inset 0 4px #07141e; }
.keno-grid button.hit {
  background: #142a25;
  border-color: #a04cf6;
  box-shadow: inset 0 0 0 3px #8829e7, inset 0 -6px #5701a9;
}
.keno-grid button.hit span {
  display: grid;
  place-items: center;
  position: relative;
  isolation: isolate;
  width: 65%;
  aspect-ratio: 1;
  clip-path: polygon(23% 0,77% 0,100% 23%,100% 77%,77% 100%,23% 100%,0 77%,0 23%);
  background: conic-gradient(from 25deg, #a1ff70, #55e71c, #179c20, #0e6d21, #53d522, #a1ff70);
  color: #10491c;
  animation: keno-hit 240ms ease-out;
}
.keno-grid button.hit span::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 14%;
  clip-path: inherit;
  background: linear-gradient(150deg, #b6ff88, #68ec46);
}
@keyframes keno-hit { from { transform: scale(.9); } to { transform: scale(1); } }
.keno-page :is(button, a, input, select):focus-visible {
  outline: 2px solid #87ddfa;
  outline-offset: 2px;
  z-index: 1;
}
.keno-selection-hint {
  margin: 14px 0 2px;
  color: var(--keno-muted);
  text-align: center;
  font-size: 14px;
  font-weight: 700;
}
.keno-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.keno-payouts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  max-width: 740px;
  margin: 14px auto 0;
}
.keno-payouts:empty { display: none; }
.keno-payouts > div {
  display: grid;
  justify-items: center;
  align-content: center;
  flex: 1 0 53px;
  max-width: 82px;
  min-height: 53px;
  gap: 4px;
  padding: 5px 3px;
  border-radius: 7px;
  background: #203544;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.keno-payout-count {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #e1edf4;
  font-size: 13px;
  font-weight: 750;
}
.keno-payout-count::after {
  content: "";
  width: 11px;
  height: 11px;
  clip-path: polygon(23% 0,77% 0,100% 23%,100% 77%,77% 100%,23% 100%,0 77%,0 23%);
  background: conic-gradient(from 25deg, #f5f8f9, #c9d1d6, #86949d, #a6b2b9, #f5f8f9);
}
.keno-payouts strong {
  padding: 2px 7px;
  border-radius: 12px;
  background: #0c202c;
  font-size: 13px;
  line-height: 1.25;
  white-space: nowrap;
}
.keno-payouts > .current { transform: translateY(-4px); background: #395567; }
.keno-payouts > .current .keno-payout-count::after {
  background: conic-gradient(from 25deg, #b6ff8b, #50f319, #1bb52a, #34d621, #b6ff8b);
}
.keno-win {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  display: grid;
  justify-items: center;
  gap: 7px;
  min-width: 180px;
  max-width: calc(100% - 20px);
  padding: 18px 24px;
  transform: translate(-50%, -50%);
  border: 1px solid #5be6b55c;
  border-radius: 15px;
  background: radial-gradient(circle at 50% 0, #136651, #092a22 75%);
  box-shadow: 0 12px 36px #000a, 0 0 25px #25de9950;
  color: #b7ffe1;
  pointer-events: none;
  animation: keno-win-in .3s ease-out;
  white-space: nowrap;
}
.keno-win-label { color: #77d9b4; font-size: 10px; font-weight: 900; letter-spacing: .16em; }
.keno-win strong { display: flex; align-items: center; gap: 7px; color: #f0fff8; font-size: 24px; line-height: 1.1; }
#keno-win-multiplier { color: #8af1be; font-size: 16px; font-weight: 900; }
@keyframes keno-win-in {
  from { opacity: 0; transform: translate(-50%, -42%) scale(.88); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@media (max-width: 700px) {
  .keno-layout { grid-template-columns: minmax(0, 1fr); }
  .keno-controls { order: 1; border-top: 1px solid #8cd8f12a; }
  .keno-payouts { gap: 5px; }
  .keno-payouts > div { flex-basis: 49px; min-height: 47px; }
  .keno-payouts strong { padding-inline: 5px; font-size: 12px; }
  .keno-win { min-width: 155px; padding: 15px 20px; }
  .keno-win strong { font-size: 21px; }
}
@media (prefers-reduced-motion: reduce) {
  .keno-grid button { transition: none; }
  .keno-grid button.hit span, .keno-win { animation: none; }
}
