/* QKAutoBet — shared Manual/Automatic betting UI styles. Loaded by
   every game page that calls QKAutoBet.register(). Designed to slot
   into the existing .gp-panel without replacing any of its current
   styles, just adding new components. */

.qk-ab-toggle-wrap {
  margin-bottom: 14px;
}
.qk-ab-toggle {
  display: flex;
  width: 100%;
  background: var(--s-bg, #050608);
  border: 1px solid var(--s-line, #1f2630);
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
}
.qk-ab-tab {
  flex: 1;
  padding: 9px 12px;
  border: 0;
  background: transparent;
  color: var(--s-muted, #9aa6b4);
  font-family: inherit;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
}
.qk-ab-tab:hover {
  color: var(--s-text, #fff);
}
.qk-ab-tab.active {
  background: var(--s-green, #7ff800);
  color: #001a00;
  box-shadow: 0 6px 16px rgba(127,248,0,.32), inset 0 -2px 0 rgba(0,0,0,.18);
}

/* Auto config panel — appears below the existing manual controls
   when Auto mode is active. Pushes the original Roll button out of
   view (the framework hides it when in auto). The [hidden] override
   is critical because `display: flex` would otherwise win over the
   browser default `display: none` from the hidden attribute. */
.qk-ab-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--s-line, #1f2630);
  animation: qkAbFadeIn .18s ease-out;
}
.qk-ab-panel[hidden] { display: none !important; }
@keyframes qkAbFadeIn {
  from { opacity: 0; transform: translateY(-2px); }
  to   { opacity: 1; transform: translateY(0); }
}

.qk-ab-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.qk-ab-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--s-muted, #9aa6b4);
}
.qk-ab-label .qk-ab-hint {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
  color: var(--s-muted-2, #6a7483);
  margin-left: 4px;
}
.qk-ab-input {
  background: var(--s-bg, #050608);
  border: 1px solid var(--s-line, #1f2630);
  color: var(--s-text, #fff);
  padding: 8px 10px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  width: 100%;
  font-variant-numeric: tabular-nums;
}
.qk-ab-input:focus {
  outline: 0;
  border-color: var(--s-green, #7ff800);
  box-shadow: 0 0 0 3px rgba(127,248,0,.18);
}

/* Game-specific enum control (e.g. dice direction, tower difficulty) */
.qk-ab-seg {
  display: flex;
  gap: 4px;
  background: var(--s-bg, #050608);
  border: 1px solid var(--s-line, #1f2630);
  border-radius: 8px;
  padding: 3px;
}
.qk-ab-seg-btn {
  flex: 1;
  padding: 7px 10px;
  border: 0;
  background: transparent;
  color: var(--s-muted, #9aa6b4);
  font-family: inherit;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
  border-radius: 6px;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.qk-ab-seg-btn:hover { color: var(--s-text, #fff); }
.qk-ab-seg-btn.active {
  background: var(--s-bg-3, #14181f);
  color: var(--s-green, #7ff800);
  box-shadow: inset 0 0 0 1px rgba(127,248,0,.5);
}

/* Advanced toggle row (label + iOS-style switch) */
.qk-ab-adv-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 4px;
  border-top: 1px dashed rgba(127,248,0,.15);
}
.qk-ab-adv-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--s-muted, #9aa6b4);
}
.qk-ab-switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  cursor: pointer;
}
.qk-ab-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.qk-ab-switch-slider {
  position: absolute;
  inset: 0;
  background: var(--s-bg, #050608);
  border: 1px solid var(--s-line, #1f2630);
  border-radius: 22px;
  transition: background .15s, border-color .15s;
}
.qk-ab-switch-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  top: 2px;
  background: var(--s-muted, #9aa6b4);
  border-radius: 50%;
  transition: transform .18s cubic-bezier(.2,.8,.2,1), background .15s;
}
.qk-ab-switch input:checked + .qk-ab-switch-slider {
  background: rgba(127,248,0,.18);
  border-color: var(--s-green, #7ff800);
}
.qk-ab-switch input:checked + .qk-ab-switch-slider::before {
  transform: translateX(16px);
  background: var(--s-green, #7ff800);
  box-shadow: 0 0 8px rgba(127,248,0,.5);
}

/* Advanced section (collapsed by default) */
.qk-ab-adv {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(127,248,0,.03);
  border: 1px dashed rgba(127,248,0,.20);
  border-radius: 10px;
}
.qk-ab-adv[hidden] { display: none !important; }
.qk-ab-status[hidden] { display: none !important; }
.qk-ab-adv-row { gap: 6px; }
.qk-ab-adv-row .qk-ab-action {
  display: flex;
  gap: 4px;
  background: var(--s-bg, #050608);
  border: 1px solid var(--s-line, #1f2630);
  border-radius: 8px;
  padding: 3px;
}
.qk-ab-action-btn {
  flex: 1;
  padding: 7px 10px;
  border: 0;
  background: transparent;
  color: var(--s-muted, #9aa6b4);
  font-family: inherit;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
  border-radius: 6px;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.qk-ab-action-btn:hover { color: var(--s-text, #fff); }
.qk-ab-action-btn.active {
  background: var(--s-bg-3, #14181f);
  color: var(--s-green, #7ff800);
  box-shadow: inset 0 0 0 1px rgba(127,248,0,.5);
}
.qk-ab-pct-wrap {
  position: relative;
  display: flex;
  align-items: center;
  margin-top: 4px;
  transition: opacity .15s;
}
.qk-ab-pct-wrap.qk-ab-disabled { opacity: 0.4; }
.qk-ab-pct {
  padding-right: 28px;
}
.qk-ab-pct-suffix {
  position: absolute;
  right: 12px;
  color: var(--s-muted, #9aa6b4);
  font-size: 12px;
  font-weight: 700;
  pointer-events: none;
}

/* Start / Stop button — when its natural position scrolls below the
   visible viewport we float a fixed-position copy at the bottom of the
   screen so the player can stop the run from anywhere on the page. */
.qk-ab-start {
  margin-top: 8px;
  width: 100%;
}
.qk-ab-start.qk-ab-stop {
  background: var(--s-red, #ef3c4e) !important;
  color: #fff !important;
  box-shadow: 0 8px 22px rgba(239,60,78,.45), inset 0 -2px 0 rgba(0,0,0,.18) !important;
}

/* Floating mirror of the Start button — only inserted by JS when the
   real button has scrolled off-screen. Pinned to the bottom of the
   viewport, with a backdrop blur so it reads against any game art. */
.qk-ab-start-floating {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 18px;
  z-index: 200;
  min-width: 220px;
  max-width: calc(100vw - 32px);
  padding: 12px 22px;
  border-radius: 999px;
  border: 0;
  font-family: inherit;
  font-weight: 900;
  font-size: 14px;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
  background: var(--s-green, #7ff800);
  color: #001a00;
  box-shadow: 0 14px 36px rgba(0,0,0,.55), 0 0 24px rgba(127,248,0,.35);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(20px);
  transition: opacity .18s, transform .22s cubic-bezier(.2,.8,.2,1);
}
.qk-ab-start-floating.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.qk-ab-start-floating.qk-ab-stop {
  background: var(--s-red, #ef3c4e);
  color: #fff;
  box-shadow: 0 14px 36px rgba(0,0,0,.55), 0 0 24px rgba(239,60,78,.45);
}

/* Info badge (i) used next to Stop-on-profit/loss labels */
.qk-ab-info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 4px;
  border-radius: 50%;
  background: rgba(127,248,0,.18);
  border: 1px solid rgba(127,248,0,.45);
  color: var(--s-green, #7ff800);
  font-size: 10px;
  font-weight: 900;
  font-style: italic;
  cursor: help;
  vertical-align: -2px;
  user-select: none;
  letter-spacing: 0;
  text-transform: none;
  transition: background .12s, transform .12s;
}
.qk-ab-info:hover {
  background: var(--s-green, #7ff800);
  color: #001a00;
  transform: scale(1.1);
}

/* ---------------------------------------------------------------------- */
/* Manual / Auto tab visibility — defense-in-depth on top of the JS
   `style.display` toggling in qk-autobet.js#setMode. The framework sets
   `data-qk-ab-mode="manual"|"auto"` on <body> whenever the user flips the
   Manual/Auto pill toggle. The JS handles the per-game registered Manual
   buttons (actionBtn + extraActionBtns) directly, so these CSS rules
   are only here as a backstop:
     - When the body is in Auto mode, mirror Manual-tab proxies in the
       mobile fixed bar (`.gp-fixed-bar .gp-btn:not([data-qk-ab-button])`)
       are hidden so phantom "Place bet" / "Cash out" buttons can't leak
       at the bottom of the viewport. This complements the inline-style
       MutationObserver in game-nav.js.
     - The floating Start mirror (`.qk-ab-start-floating`) only ever
       becomes visible in Auto mode via the `.visible` class added by
       qk-autobet.js, so we belt-and-brace it with a CSS rule that
       hides it whenever the page isn't in Auto. */
body[data-qk-ab-mode="auto"] .gp-fixed-bar .gp-btn:not([data-qk-ab-button]) {
  display: none !important;
}
/* In Manual mode, hide the floating Start mirror (it's only meaningful
   while a run is active, and the panel itself is hidden anyway). */
body:not([data-qk-ab-mode="auto"]) .qk-ab-start-floating { display: none !important; }

/* Live status line */
.qk-ab-status {
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255,255,255,.03);
  color: var(--s-muted, #9aa6b4);
  font-variant-numeric: tabular-nums;
}
.qk-ab-status-info { color: var(--s-text, #fff); }
.qk-ab-status-good { color: var(--s-green, #7ff800); background: rgba(127,248,0,.06); }
.qk-ab-status-warn { color: var(--s-gold, #fce403); background: rgba(252,228,3,.06); }
.qk-ab-status-err  { color: var(--s-red-2, #ff5d6c); background: rgba(239,60,78,.08); }
