/* Keno game — vanilla DOM, namespaced under #keno-game.
   Visual parity with lib/keno_game/* (header, grid, hint banner, difficulty,
   bet, launch, random, clear/rounds, mode). */

#keno-game {
  --kn-bg: #0A1A29;
  --kn-panel: #0F1721;
  --kn-tile-default: #2A3752;
  --kn-tile-selected: #8E52FF;
  --kn-tile-hit: #FFEB3B;       /* yellow when result + selected */
  --kn-text: #ffffff;
  --kn-text-dim: rgba(255,255,255,.65);
  --kn-border: #242D3A;
  --kn-accent-blue: #4DA3FF;
  --kn-accent-yellow: #FFD54F;

  position: relative;
  width: 100%;
  height: 100%;
  background: var(--kn-bg);
  color: var(--kn-text);
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

#keno-game * { box-sizing: border-box; }

#keno-game .kn-inner {
  max-width: 500px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  flex: 1 1 auto;
}

/* ---------- Header (mirrors keno_game/head/header.dart) ---------- */
#keno-game .kn-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 50px;
  padding: 2px 0 0;
  flex-shrink: 0;
}
#keno-game .kn-header-left,
#keno-game .kn-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
#keno-game .kn-icon-btn {
  width: 32px; height: 32px;
  background: transparent;
  border: 0;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
#keno-game .kn-icon-btn:disabled { opacity: .4; cursor: not-allowed; }
#keno-game .kn-icon-btn svg { width: 32px; height: 32px; fill: currentColor; }
#keno-game .kn-back-btn:hover svg { fill: var(--kn-accent-yellow); }

#keno-game .kn-wallet {
  height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: rgba(43,43,64,.7);
  border-radius: 8px;
  font-family: 'DM Sans', 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
#keno-game .kn-wallet svg { width: 18px; height: 18px; fill: #FFE94A; }

#keno-game .kn-more-games {
  height: 32px;
  padding: 0 14px;
  background: transparent;
  border: 1.2px solid rgba(255,255,255,.7);
  border-radius: 16px;
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .3px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s, color .15s;
}
#keno-game .kn-more-games:hover { background: rgba(255,255,255,.05); color: var(--kn-accent-yellow); }

/* ---------- Grid (40 cells, 8 cols × 5 rows, square aspect) ---------- */
#keno-game .kn-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 7px;
  margin: 15px 0 5px;
}
#keno-game .kn-tile {
  aspect-ratio: 1 / 1;
  border: 0;
  border-radius: 10px;
  background: var(--kn-tile-default);
  color: #fff;
  font-family: 'DM Sans', 'Inter', sans-serif;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, transform .12s;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
}
#keno-game .kn-tile:active { transform: scale(0.94); }
#keno-game .kn-tile.default { background: var(--kn-tile-default); color: #fff; }
#keno-game .kn-tile.selected { background: var(--kn-tile-selected); color: #fff; }
#keno-game .kn-tile.result-hit { background: var(--kn-tile-hit); color: #000; }
#keno-game .kn-tile.result-miss { background: transparent; color: #ff5252; }
#keno-game .kn-tile.result-default { background: var(--kn-tile-default); color: #fff; }

@media (max-width: 480px) {
  #keno-game .kn-tile { font-size: 12px; border-radius: 8px; }
}
@media (max-width: 400px) {
  #keno-game .kn-tile { font-size: 10px; border-radius: 6px; }
  #keno-game .kn-grid { gap: 5px; }
}

/* ---------- Hint banner (mirrors KenoHintBanner) ---------- */
#keno-game .kn-hint {
  height: 40px;
  border: 1.2px solid var(--kn-border);
  border-radius: 18px;
  display: flex;
  align-items: stretch;
  overflow: hidden;
}
#keno-game .kn-hint--prompt {
  align-items: center;
  justify-content: center;
}
#keno-game .kn-hint-prompt {
  width: 100%;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--kn-accent-yellow);
}
#keno-game .kn-hint-cell {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  font-family: 'Inter', system-ui, sans-serif;
  background: transparent;
}
#keno-game .kn-hint-cell:first-child { border-radius: 18px 0 0 18px; }
#keno-game .kn-hint-cell:last-child { border-radius: 0 18px 18px 0; }
#keno-game .kn-hint-cell--alt { background: #15202E; }
#keno-game .kn-hint-cell--good { background: rgba(255,255,0,0.2); }
#keno-game .kn-hint-hit {
  font-size: 11px;
  font-weight: 700;
  color: #B9C4D6;
  line-height: 1;
}
#keno-game .kn-hint-odds {
  font-family: 'Roboto Mono', ui-monospace, monospace;
  font-size: 9px;
  font-weight: 700;
  color: #B9C4D6;
  line-height: 1;
}
#keno-game .kn-hint-cell--good .kn-hint-hit { color: #FFEB3B; }
#keno-game .kn-hint-cell--good .kn-hint-odds { color: #ff4444; }
@media (max-width: 480px) {
  #keno-game .kn-hint-hit { font-size: 9px; }
  #keno-game .kn-hint-odds { font-size: 7px; }
}
@media (max-width: 400px) {
  #keno-game .kn-hint-hit { font-size: 7px; }
  #keno-game .kn-hint-odds { font-size: 5px; }
}

/* ---------- Difficulty bar ---------- */
#keno-game .kn-controls {
  display: flex;
  flex-direction: column;
  gap: 15px;
  flex-shrink: 0;
}
#keno-game .kn-diff {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  background: var(--kn-panel);
  border-radius: 8px;
  overflow: hidden;
}
#keno-game .kn-diff-btn {
  height: 40px;
  border: 0;
  background: var(--kn-panel);
  color: #fff;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
  transition: background .15s;
  -webkit-tap-highlight-color: transparent;
}
#keno-game .kn-diff-btn.active {
  background: #2188FF;
  color: #000;
}
#keno-game .kn-diff-btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Bet stepper (tower-style segmented "− BET / 10 +") ---------- */
#keno-game .kn-bet {
  height: 45px;
  background: linear-gradient(180deg, #1d1d2e 0%, #15151f 100%);
  border-radius: 12px;
  padding: 0 6px;
  display: grid;
  grid-template-columns: 22px 1fr 22px;
  align-items: center;
  gap: 4px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.04),
    inset 0 -1px 0 rgba(0,0,0,.4),
    0 1px 0 rgba(255,255,255,.03);
}
#keno-game .kn-bet-step {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
  padding: 0;
  line-height: 0;
  border: 0;
  cursor: pointer;
  transition: transform 100ms ease, filter 120ms ease;
  -webkit-tap-highlight-color: transparent;
}
#keno-game .kn-bet-step svg {
  width: 16px; height: 16px;
  fill: #1a1a1a;
  display: block;
  filter: drop-shadow(0 1px 0 rgba(255,255,255,.18));
}
#keno-game .kn-bet-dec {
  background: radial-gradient(circle at 30% 30%, #ff6b6b, #c93a3a);
  box-shadow: 0 2px 6px rgba(201,58,58,.45), inset 0 1px 0 rgba(255,255,255,.35);
}
#keno-game .kn-bet-inc {
  background: radial-gradient(circle at 30% 30%, #56dd76, #2fa84a);
  box-shadow: 0 2px 6px rgba(47,168,74,.45), inset 0 1px 0 rgba(255,255,255,.35);
}
#keno-game .kn-bet-step:not(:disabled):hover  { filter: brightness(1.1); transform: translateY(-1px); }
#keno-game .kn-bet-step:not(:disabled):active { transform: translateY(1px); filter: brightness(.92); }
/* Disabled: keep full color (per design); just block pointer interaction.
   Re-state the enabled background with !important so the UA's default
   disabled-button styling can't gray the circle out. */
#keno-game .kn-bet-dec:disabled {
  background: radial-gradient(circle at 30% 30%, #ff6b6b, #c93a3a) !important;
  box-shadow: 0 2px 6px rgba(201,58,58,.45), inset 0 1px 0 rgba(255,255,255,.35) !important;
  opacity: 1 !important;
  filter: none !important;
  cursor: not-allowed;
}
#keno-game .kn-bet-inc:disabled {
  background: radial-gradient(circle at 30% 30%, #56dd76, #2fa84a) !important;
  box-shadow: 0 2px 6px rgba(47,168,74,.45), inset 0 1px 0 rgba(255,255,255,.35) !important;
  opacity: 1 !important;
  filter: none !important;
  cursor: not-allowed;
}
#keno-game .kn-bet-step:disabled svg { fill: #1a1a1a !important; opacity: 1 !important; }

#keno-game .kn-bet-readout {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
  gap: 2px;
  min-width: 0;
  padding: 0 4px;
}
#keno-game .kn-bet-readout .kn-bet-label {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 8px;
  color: #6e6e88;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  font-weight: 600;
}
#keno-game .kn-bet-readout .kn-bet-value {
  font-family: 'Roboto Mono', ui-monospace, monospace;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .3px;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 400px) {
  #keno-game .kn-bet { grid-template-columns: 16px 1fr 16px; }
  #keno-game .kn-bet-step { width: 18px; height: 18px; }
  #keno-game .kn-bet-step svg { width: 12px; height: 12px; }
}

/* ---------- Bottom actions row (tower parity: Bet stepper + Credits + Launch) ---------- */
#keno-game .kn-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  align-items: stretch;
}
#keno-game .kn-actions > * { min-width: 0; }
@media (max-width: 400px) {
  #keno-game .kn-actions { gap: 8px; }
}

/* Aux row — Quick Pick on the left, Clear (Manual) or Rounds (Auto) on the right */
#keno-game .kn-aux-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: stretch;
}
#keno-game .kn-aux-row > * { min-width: 0; }
@media (max-width: 400px) {
  #keno-game .kn-aux-row { gap: 8px; }
}

/* Credits readout (tower-style gold value, used as wallet) */
#keno-game .kn-balance {
  height: 45px;
  background: linear-gradient(180deg, #15151f 0%, #1d1d2e 100%);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0 6px;
  gap: 2px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), inset 0 -1px 0 rgba(0,0,0,.4);
}
#keno-game .kn-balance .kn-balance-label {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 8px;
  color: #6e6e88;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  font-weight: 600;
}
#keno-game .kn-balance .kn-balance-value {
  font-family: 'Roboto Mono', ui-monospace, monospace;
  font-size: 15px;
  font-weight: 700;
  color: #ffd54a;
  text-shadow: 0 0 12px rgba(255,213,74,.25);
  letter-spacing: .3px;
}

/* Launch CTA — tower green default, gray when disabled */
#keno-game .kn-launch-btn {
  position: relative;
  width: 100%;
  height: 45px;
  border: 0;
  border-radius: 12px;
  font-family: 'Poppins', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .8px;
  color: #fff;
  text-transform: uppercase;
  text-shadow: 0 2px 4px rgba(0,0,0,.45);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 6px;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease, box-shadow 200ms ease;
  background: linear-gradient(180deg, #2bd957 0%, #16a23a 100%);
  box-shadow:
    0 4px 14px rgba(43,217,87,.45),
    0 0 24px rgba(43,217,87,.18),
    inset 0 1px 0 rgba(255,255,255,.35),
    inset 0 -2px 0 rgba(0,0,0,.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  -webkit-tap-highlight-color: transparent;
}
#keno-game .kn-launch-btn::before {
  content: '';
  position: absolute;
  inset: 1px 1px auto 1px;
  height: 45%;
  border-radius: 11px 11px 50% 50% / 11px 11px 100% 100%;
  background: linear-gradient(180deg, rgba(255,255,255,.3), rgba(255,255,255,0));
  pointer-events: none;
}
#keno-game .kn-launch-btn:not(:disabled):hover  { filter: brightness(1.08); }
#keno-game .kn-launch-btn:not(:disabled):active { transform: translateY(1px); filter: brightness(.95); }
#keno-game .kn-launch-btn[disabled] {
  cursor: not-allowed;
  background: linear-gradient(180deg, #2c4a3b 0%, #1a3127 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), inset 0 -1px 0 rgba(0,0,0,.4);
  color: #8aa39a;
  text-shadow: none;
}
#keno-game .kn-launch-btn[disabled]::before { display: none; }
#keno-game .kn-launch-icon {
  display: inline-block;
  width: 12px;
  height: 12px;
}
#keno-game .kn-launch-icon--play {
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 12px solid #fff;
}
#keno-game .kn-launch-icon--stop {
  width: 12px;
  height: 12px;
  background: #fff;
}

/* ---------- Quick Pick / Random ---------- */
#keno-game .kn-random-btn {
  width: 100%;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: #C74AD8;
  color: #fff;
  font-family: 'Poppins', 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.8px;
  cursor: pointer;
  text-shadow: 1px 2px 3px rgba(0,0,0,.5);
  -webkit-tap-highlight-color: transparent;
  transition: filter .12s, transform .1s;
}
#keno-game .kn-random-btn:not(:disabled):hover { filter: brightness(1.08); }
#keno-game .kn-random-btn:not(:disabled):active { transform: scale(0.98); }
#keno-game .kn-random-btn:disabled { background: #382E58; cursor: not-allowed; }

/* ---------- Clear button ---------- */
#keno-game .kn-clear-btn {
  width: 100%;
  height: 40px;
  background: transparent;
  border: 1.2px solid var(--kn-border);
  border-radius: 10px;
  color: #fff;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.2px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s;
}
#keno-game .kn-clear-btn:not(:disabled):hover { background: rgba(255,255,255,.04); }
#keno-game .kn-clear-btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Auto Bet toggle row (mirrors mines #auto) ----------
   Auto Bet label + switch on the LEFT, sound chip on the RIGHT. */
#keno-game .kn-auto-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 32px;
  margin-top: 2px;
  padding: 0 4px;
}
#keno-game .kn-auto-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
#keno-game .kn-auto-label {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 10px;
  font-weight: 500;
  color: #fff;
  letter-spacing: normal;
  text-transform: none;
}
#keno-game .kn-auto-count {
  margin-left: 0;
  color: #ffeb3b;
  font-variant-numeric: tabular-nums;
}
/* Material switch (mines parity, scaled): inactive #1B1B2C, active green. */
#keno-game .kn-auto-switch {
  position: relative;
  width: 36px;
  height: 20px;
  border-radius: 12px;
  background: #1B1B2C;
  cursor: pointer;
  transition: background 150ms ease;
  -webkit-tap-highlight-color: transparent;
}
#keno-game .kn-auto-switch[data-on="1"] { background: #2da046; }
#keno-game .kn-auto-switch::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  top: 2px;
  left: 2px;
  box-shadow: 0 1px 2px rgba(0,0,0,.3);
  transition: left 150ms ease;
}
#keno-game .kn-auto-switch[data-on="1"]::after { left: 18px; }
/* Sound chip — borderless, hover-tinted (matches mines #auto .icon-btn) */
#keno-game .kn-sound-fab {
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 140ms ease, transform 100ms ease;
  -webkit-tap-highlight-color: transparent;
}
#keno-game .kn-sound-fab svg {
  width: 22px;
  height: 22px;
  fill: rgba(255,255,255,.85);
  transition: fill 140ms ease;
}
#keno-game .kn-sound-fab:hover { background: rgba(255,255,255,.06); }
#keno-game .kn-sound-fab:hover svg { fill: #ffd54a; }
#keno-game .kn-sound-fab:active { transform: scale(0.92); }

/* ---------- Win flash overlay (mirrors CrashOverlay) ---------- */
#keno-game .kn-grid { position: relative; }
#keno-game .kn-win-flash {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.6);
  padding: 22px 44px;
  background: rgba(10, 10, 30, 0.88);
  border: 2px solid var(--kn-accent-yellow);
  border-radius: 16px;
  font-family: 'Bangers', 'Poppins', system-ui, sans-serif;
  font-weight: 400;
  text-align: center;
  color: #fff;
  opacity: 0;
  pointer-events: auto;
  animation: kn-win-pop 2.2s ease forwards;
  box-shadow: 0 12px 36px rgba(0,0,0,.65), 0 0 40px rgba(255,213,74,.18);
  white-space: nowrap;
  z-index: 50;
}
#keno-game .kn-win-flash .kn-win-multi {
  font-size: 36px;
  color: #00E676;
  letter-spacing: 2px;
  line-height: 1.05;
}
#keno-game .kn-win-flash .kn-win-amount {
  font-size: 32px;
  color: #ffc107;
  margin-top: 6px;
  letter-spacing: 2px;
  line-height: 1.05;
  text-shadow: 2px 2px 6px rgba(0,0,0,.5);
}
@keyframes kn-win-pop {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
  10%  { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  20%  { transform: translate(-50%, -50%) scale(0.95); }
  30%  { transform: translate(-50%, -50%) scale(1.0); }
  85%  { opacity: 1; transform: translate(-50%, -50%) scale(1.0); }
  100% { opacity: 0; transform: translate(-50%, -55%) scale(1.0); }
}

/* ---------- Insufficient Balance dialog ---------- */
.kn-modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  font-family: 'Inter', system-ui, sans-serif;
}
.kn-ib-dialog {
  width: 100%;
  max-width: 320px;
  background: #2C2C34;
  border-radius: 20px;
  padding: 24px 22px 20px;
  color: #fff;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.kn-ib-title { font-size: 20px; font-weight: 700; margin-bottom: 14px; }
.kn-ib-msg { font-size: 16px; color: rgba(255,255,255,.7); line-height: 1.45; margin-bottom: 22px; }
.kn-ib-btn {
  background: #607D8B;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 28px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.kn-ib-btn:hover { filter: brightness(1.08); }

/* ---------- Auto Times dialog (mirrors web/games/mines/play/css/overlay.css .auto-modal) ---------- */
.kn-modal-back {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
  pointer-events: auto;
  font-family: 'Inter', system-ui, sans-serif;
}
.kn-auto-modal {
  width: min(360px, 92%);
  padding: 26px 16px 18px;
  background: #17173A;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 22px;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(178, 111, 255, 0.12) inset;
  font-family: 'Inter', system-ui, sans-serif;
  animation: kn-auto-modal-in 240ms cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes kn-auto-modal-in {
  from { opacity: 0; transform: scale(0.92) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.kn-auto-modal-title {
  margin: 0 0 22px;
  text-align: center;
  font-size: 20px;
  font-weight: 800;
  color: #FFE94A;
  letter-spacing: 0.3px;
  text-shadow: 0 2px 8px rgba(255, 233, 74, 0.25);
}
.kn-auto-modal-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
}
.kn-auto-modal-opt {
  position: relative;
  width: 100%;
  height: 46px;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(90deg, #B26FFF 0%, #E58CB6 50%, #FFC466 100%);
  color: #fff;
  font-family: 'Poppins', system-ui, sans-serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  box-shadow:
    0 4px 12px rgba(178, 111, 255, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 -2px 6px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease;
}
.kn-auto-modal-opt::before {
  content: '';
  position: absolute;
  inset: 1px 1px auto 1px;
  height: 45%;
  border-radius: 13px 13px 50% 50% / 13px 13px 100% 100%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0));
  pointer-events: none;
}
.kn-auto-modal-opt:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow:
    0 8px 18px rgba(178, 111, 255, 0.38),
    0 0 0 1px rgba(255, 196, 102, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    inset 0 -2px 6px rgba(0, 0, 0, 0.18);
}
.kn-auto-modal-opt:active {
  transform: translateY(1px);
  filter: brightness(0.96);
  box-shadow:
    0 2px 6px rgba(178, 111, 255, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -1px 3px rgba(0, 0, 0, 0.18);
}
.kn-auto-modal-num {
  position: relative;
  font-variant-numeric: tabular-nums;
}
.kn-auto-modal-suffix {
  position: relative;
  margin-left: 6px;
  font-weight: 600;
  opacity: 0.92;
}
.kn-auto-modal-cancel {
  width: 100%;
  height: 42px;
  background: #283151;
  color: #fff;
  border: 0;
  font-size: 15px;
  font-weight: 600;
  border-radius: 14px;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: background 140ms ease, transform 100ms ease;
}
.kn-auto-modal-cancel:hover  { background: #34406d; }
.kn-auto-modal-cancel:active { transform: translateY(1px); }

/* ---------- Sound settings dialog (mirrors web/games/tower/play/tower.css .tw-ss-*) ---------- */
.kn-ss-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
  animation: kn-ss-mask-in 180ms ease;
  font-family: 'Inter', system-ui, sans-serif;
}
@keyframes kn-ss-mask-in { from { opacity: 0; } to { opacity: 1; } }
.kn-ss-dialog {
  width: 340px;
  max-width: 100%;
  background: #1A2332;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  overflow: hidden;
  color: #fff;
  animation: kn-ss-dialog-in 220ms cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
@keyframes kn-ss-dialog-in {
  from { opacity: 0; transform: scale(0.94) translateY(6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.kn-ss-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.kn-ss-title { color: rgba(255,255,255,.75); font-size: 14px; font-weight: 700; letter-spacing: 1.5px; }
.kn-ss-close {
  background: transparent; border: 0;
  color: rgba(255,255,255,.4);
  cursor: pointer;
  padding: 4px;
  display: inline-flex;
  border-radius: 4px;
  transition: color .15s, background .15s;
}
.kn-ss-close:hover { color: #fff; background: rgba(255,255,255,.08); }

.kn-ss-row {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  gap: 14px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.kn-ss-row:last-child { border-bottom: none; }
.kn-ss-label { flex: 0 0 40%; color: rgba(255,255,255,.6); font-size: 15px; }

.kn-ss-switch {
  position: relative;
  display: inline-block;
  margin-left: auto;
  cursor: pointer;
}
.kn-ss-switch input {
  appearance: none;
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0; height: 0;
}
.kn-ss-switch-track {
  display: inline-block;
  width: 44px; height: 24px;
  border-radius: 12px;
  background: rgba(255,255,255,.12);
  transition: background .2s;
  position: relative;
}
.kn-ss-switch-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(255,255,255,.7);
  transition: transform .2s, background .2s;
}
.kn-ss-switch input:checked + .kn-ss-switch-track { background: rgba(74,158,255,.4); }
.kn-ss-switch input:checked + .kn-ss-switch-track .kn-ss-switch-thumb {
  transform: translateX(20px);
  background: #4A9EFF;
}

input.kn-ss-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right,
    #4A9EFF 0%, #4A9EFF var(--fill, 100%),
    rgba(255,255,255,.12) var(--fill, 100%), rgba(255,255,255,.12) 100%);
  outline: none;
  cursor: pointer;
}
input.kn-ss-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,.5);
  cursor: pointer;
}
input.kn-ss-slider::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,.5);
  cursor: pointer;
}
