  /* ===================================================================
     MYBC Originals — Tower
     1:6222 desktop frame (1168 x 750)
     =================================================================== */
  :root {
    /* Brand Surfaces (matched from Limbo) */
    --panel:        #1E1845;
    --surface:      #23204E; /* header/footer chrome — same as mines */
    --board:        #120D24;
    --card-bg:      #1E1845;
    --elevated:     #272859;
    --card-shadow:  #0a0818;
    --hairline:     rgba(255, 255, 255, 0.06);

    /* Toggle / inputs */
    --toggle-bg:     rgba(30, 24, 69, 0.8);
    --toggle-border: rgba(255, 255, 255, 0.12);
    --input-border:  rgba(255, 255, 255, 0.10);
    --input-bg-from: #1E1845;
    --input-bg-to:   #1E1845;
    --chip-bg:       #1E1845;

    /* Typography colors */
    --text:        #FFFFFF;
    --text-75:     rgba(255, 255, 255, 0.75);
    --text-mid:    #8B8BA3;
    --text-dim:    rgba(139, 139, 163, 0.50);
    --text-dimmer: #5C5C7A;

    /* Accent — Primary (Gold) */
    --accent:        #F7931A;
    --accent-border: rgba(247, 147, 26, 0.45);
    --accent-glow:   rgba(247, 147, 26, 0.20);
    --plum:          rgba(247, 147, 26, 0.08);
    --plum-2:        rgba(247, 147, 26, 0.15);
    --indigo-line:   rgba(255, 255, 255, 0.12);

    /* Multiplier states */
    --gold:        #F7931A;
    --gold-bg:     rgba(247, 147, 26, 0.2);
    --green:       #0ECC68;
    --green-bg:    rgba(14, 204, 104, 0.12);
    --red:         #F85F5D;
    --red-bg:      rgba(248, 95, 93, 0.15);
    --locked-bg:   rgba(255, 255, 255, 0.08);

    /* Player buttons */
    --pad-bg:        #1E1845;
    --pad-border:    rgba(255, 255, 255, 0.12);
    --pad-shadow:    #0a0818;

    /* Payout panel */
    --payout-head-bg:    #1E1845;
    --payout-body-bg:    #1E1845;
    --green-bright:      #10e676;
  }

  * { box-sizing: border-box; margin: 0; padding: 0; }
  *, *::before, *::after { touch-action: manipulation; }
  html, body {
    height: 100%;
    background: #120D24;
    color: var(--text);
    font-family: 'Montserrat', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
    margin: 0;
    padding: 0;
  }
  body {
    display: flex;
  }
  #root {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
  }

  /* ============= APP FRAME — centered box on desktop ============= */
  .app {
    width: 100%;
    height: 100dvh;
    border-radius: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--panel);
    box-shadow: none;
  }
  /* Mines-style shell: stack vertically (board on top, controls bar at bottom) */
  .row {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }

  /* ============= BOTTOM CONTROLS BAR (no sidebar) ============= */
  .side {
    width: 100%;
    flex-shrink: 0;
    background: var(--panel);
    border-top: 1px solid var(--hairline);
    padding: 12px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: visible;
  }
  .side-header { display: none; }

  /* Bet amount input */
  .bet-amount-wrap { display: flex; flex-direction: column; gap: 6px; }
  .label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-mid);
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
  .input-row {
    height: 46px;
    display: flex;
    align-items: center;
    border: 1px solid var(--input-border);
    border-radius: 10px;
    overflow: hidden;
    background: linear-gradient(180deg, #1E1845 0%, #1E1845 100%);
    transition: border-color 0.2s, box-shadow 0.2s;
  }
  .input-row:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(247, 147, 26, 0.08); }
  .input-row .currency {
    width: 38px;
    font-weight: 600;
    font-size: 14px;
    color: var(--accent);
    text-align: center;
    flex-shrink: 0;
  }
  .input-row input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    outline: none;
    font-family: inherit;
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
    padding: 0 8px;
    -moz-appearance: textfield;
  }
  .input-row input::-webkit-outer-spin-button,
  .input-row input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
  .input-row input::placeholder { color: var(--text-dimmer); }
  .input-row .chips {
    display: flex;
    gap: 4px;
    padding: 0 8px;
    flex-shrink: 0;
  }
  .input-row .chip {
    width: 40px;
    height: 30px;
    border-radius: 8px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--toggle-border);
    color: var(--text-75);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
  }
  .chip:disabled { opacity: 0.3; cursor: not-allowed; }
  .input-row .chip:hover {
    border-color: var(--accent-border);
    background: rgba(247, 147, 26, 0.08);
    transform: translateY(-1px);
  }
  /* Bet steppers (− / +) inside the input row, like mines */
  .input-row .stepper {
    width: 36px;
    height: 100%;
    flex-shrink: 0;
    background: rgba(255,255,255,0.04);
    border: none;
    color: var(--text-75);
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    -webkit-tap-highlight-color: transparent;
  }
  .input-row .stepper:disabled { opacity: 0.3; cursor: not-allowed; }
  @media (hover: hover) {
    .input-row .stepper:hover:not(:disabled) { background: rgba(247,147,26,0.12); color: var(--accent); }
  }
  /* Quick-amount chips row (1 / 5 / 10 / Max) below the input */
  .bet-chips {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    margin-top: 6px;
  }
  .bet-chips .chip {
    height: 30px;
    border-radius: 8px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--toggle-border);
    color: var(--text-75);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
  }
  @media (hover: hover) {
    .bet-chips .chip:hover:not(:disabled) {
      border-color: var(--accent-border);
      background: rgba(247, 147, 26, 0.08);
      transform: translateY(-1px);
    }
  }

  /* Place / Cash-out buttons */
  .place-btn {
    height: 50px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #F7931A 0%, #E67A00 100%);
    color: #fff;
    font-family: inherit;
    font-weight: 800;
    font-size: 15px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    transition: all 0.2s;
    box-shadow: 0 4px 16px rgba(247,147,26,0.30), inset 0 1px 0 rgba(255,255,255,0.2);
  }
  .place-btn:hover:not(:disabled) {
    filter: brightness(1.08);
    box-shadow: 0 6px 24px rgba(247,147,26,0.40), inset 0 1px 0 rgba(255,255,255,0.2);
    transform: translateY(-1px);
  }
  .place-btn:active:not(:disabled) { transform: translateY(0); }
  .place-btn:disabled { opacity: 0.4; cursor: not-allowed; filter: none; transform: none; }

  .cashout-btn {
    height: 50px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #0ECC68 0%, #0aa855 100%);
    color: #fff;
    font-family: inherit;
    font-weight: 800;
    font-size: 15px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    width: 100%;
    transition: all 0.2s;
    box-shadow: 0 4px 16px rgba(14,204,104,0.30), inset 0 1px 0 rgba(255,255,255,0.2);
    animation: cashoutPulse 1.5s ease-in-out infinite;
  }
  .cashout-btn:hover:not(:disabled) {
    filter: brightness(1.08);
    box-shadow: 0 6px 24px rgba(14,204,104,0.40), inset 0 1px 0 rgba(255,255,255,0.2);
    transform: translateY(-1px);
  }
  .cashout-btn:disabled { opacity: 0.4; cursor: not-allowed; }
  .cashout-btn.cashout-ready {
    background: linear-gradient(135deg, #0ECC68 0%, #0aa855 100%);
    color: #fff;
    box-shadow: 0 4px 16px rgba(14,204,104,0.30), inset 0 1px 0 rgba(255,255,255,0.2);
  }
  .cashout-btn.cashout-ready:hover:not(:disabled) { filter: brightness(1.1); }
  @keyframes cashoutPulse {
    0%, 100% { box-shadow: 0 4px 16px rgba(14,204,104,0.30), inset 0 1px 0 rgba(255,255,255,0.2); }
    50% { box-shadow: 0 6px 28px rgba(14,204,104,0.50), inset 0 1px 0 rgba(255,255,255,0.2); }
  }

  /* Mode toggle */
  .mode-toggle {
    display: flex;
    background: var(--toggle-bg);
    border: 1px solid var(--toggle-border);
    border-radius: 10px;
    padding: 4px;
    gap: 4px;
  }
  .mode-toggle button {
    flex: 1;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-mid);
    font-family: inherit;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.25s;
  }
  .mode-toggle button.active {
    background: linear-gradient(257.95deg, #E67A00 2.9%, #F7931A 54.68%, #F7951C 95.53%);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 2px 10px rgba(247,147,26,0.30);
  }

  /* Manual / Auto panels */
  .manual-panel { display: flex; flex-direction: column; gap: 10px; }
  .auto-panel   { display: none; flex-direction: column; gap: 10px; }
  .app.auto-mode .manual-panel { display: none; }
  .app.auto-mode .auto-panel   { display: flex; }
  .place-btn, .cashout-btn { position: relative; }
  .app.playing .place-btn { display: none; }
  .cashout-btn { display: none; }
  .app.playing .cashout-btn { display: block; }

  /* ===== Stake-style bet controls (exact mines values) ===== */
  .stake-bet { display: flex; gap: 6px; width: 100%; align-items: stretch; }
  .stake-left { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
  .stake-input {
    display: flex; align-items: center; gap: 0;
    background: var(--board); border: 1px solid var(--hairline);
    border-radius: 10px; height: 38px; overflow: hidden;
  }
  .stake-pm {
    width: 36px; height: 100%; background: none; border: none;
    color: var(--text-mid); font-size: 18px; font-weight: 400; cursor: pointer;
    display: flex; align-items: center; justify-content: center; transition: color 0.12s;
    -webkit-tap-highlight-color: transparent;
  }
  .stake-pm:active { color: var(--text); }
  .stake-pm:disabled { opacity: 0.3; cursor: not-allowed; }
  .stake-amount {
    flex: 1; min-width: 0; background: none; border: none; outline: none;
    color: var(--text); font-size: 14px; font-weight: 600; text-align: center;
    font-family: inherit; -moz-appearance: textfield;
  }
  .stake-amount::-webkit-inner-spin-button,
  .stake-amount::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
  .stake-amount:disabled { opacity: 0.5; }
  /* Mini balance inside the bet input — desktop only */
  .stake-input .stake-bal { display: none; }
  @media (min-width: 861px) {
    .stake-input .stake-bal { display: flex; align-items: center; align-self: stretch; white-space: nowrap; font-size: 10px; font-weight: 600; color: var(--accent); border-left: 1px solid var(--hairline); padding: 0 10px 0 8px; flex-shrink: 0; }
  }
  .stake-chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; }
  .stake-chip {
    height: 28px; background: var(--board); border: 1px solid var(--hairline);
    border-radius: 6px; color: var(--text-mid); font-size: 11px; font-weight: 600;
    cursor: pointer; transition: all 0.12s; font-family: inherit;
    -webkit-tap-highlight-color: transparent;
  }
  .stake-chip:active { background: rgba(255,255,255,0.08); color: var(--text); }
  .stake-chip:disabled { opacity: 0.3; cursor: not-allowed; }
  /* place / cash-out / stop button beside the stake column (column layout for label+amount) */
  .stake-bet .place-btn,
  .stake-bet .cashout-btn,
  .stake-bet .auto-stop-bet-btn {
    flex: 0 0 42%; height: auto; align-self: stretch;
    flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  }
  /* show exactly ONE: place (idle) → cashout (playing) → stop auto (auto running) */
  .stake-bet .place-btn { display: flex; }
  .stake-bet .cashout-btn { display: none; }
  .app.playing .stake-bet .place-btn { display: none; }
  .app.playing .stake-bet .cashout-btn { display: flex; }
  /* BET button — solid accent + label/amount stacked (exact mines style) */
  .stake-bet .place-btn {
    background: var(--accent);
    box-shadow: none; text-transform: none; letter-spacing: 0;
  }
  .stake-bet-label {
    font-size: 12px; font-weight: 600; color: rgba(255,255,255,0.7);
    text-transform: uppercase; letter-spacing: 0.04em; line-height: 1.1;
  }
  .stake-bet-amount { font-size: 15px; font-weight: 800; color: #fff; line-height: 1.1; }
  .stake-bet .cashout-btn {
    font-size: 13px; text-transform: uppercase; letter-spacing: 0.02em;
    line-height: 1.15; white-space: normal; padding: 4px 8px;
  }
  /* The bet button position turns into STOP AUTO while auto play runs */
  .stake-bet .auto-stop-bet-btn {
    display: none;
    flex: 0 0 42%; align-self: stretch;
    flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    border: 1px solid rgba(248,95,93,0.45); border-radius: 10px;
    background: rgba(248,95,93,0.15); color: var(--red);
    font-family: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  .stake-bet .auto-stop-bet-btn .auto-stop-label { font-weight: 800; font-size: 13px; letter-spacing: 0.04em; }
  .stake-bet .auto-stop-bet-btn .auto-stop-sub { font-size: 10px; opacity: 0.85; font-variant-numeric: tabular-nums; }
  .app.auto-running .stake-bet .place-btn,
  .app.auto-running .stake-bet .cashout-btn { display: none !important; }
  .app.auto-running .stake-bet .auto-stop-bet-btn { display: flex; }
  /* lock the bet/risk controls while auto runs */
  .app.auto-running .stake-left,
  .app.auto-running .manual-risk-section { opacity: 0.45; pointer-events: none; }
  /* risk = inline difficulty buttons (no dropdown), like mines' grid buttons */
  .manual-risk-section { display: flex; flex-direction: column; gap: 4px; }
  .risk-label {
    font-size: 11px; font-weight: 600; color: var(--text-mid);
    text-transform: uppercase; letter-spacing: 0.04em;
  }
  .risk-options { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; }
  .risk-btn {
    min-height: 40px; padding: 4px 2px; background: var(--board); border: 1px solid var(--hairline);
    border-radius: 6px; color: var(--text-mid); font-weight: 600;
    cursor: pointer; transition: background 0.12s, border-color 0.12s, color 0.12s; font-family: inherit;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
    -webkit-tap-highlight-color: transparent;
  }
  .risk-btn-label { font-size: 11px; font-weight: 700; line-height: 1.1; }
  .risk-btn-sub { font-size: 9px; font-weight: 600; opacity: 0.7; line-height: 1.1; white-space: nowrap; }
  .risk-btn.active .risk-btn-sub { opacity: 0.9; }
  .risk-btn:disabled { opacity: 0.4; cursor: not-allowed; }
  .risk-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

  /* ===== Risk level palette (green → red) =====
     Inactive: soft tinted fill + colored edge/text. Active: solid fill. */
  .risk-btn--easy   { background: rgba(14, 204, 104, 0.12); border-color: rgba(14, 204, 104, 0.45); color: #4be39a; }
  .risk-btn--medium { background: rgba(247, 201, 72, 0.12); border-color: rgba(247, 201, 72, 0.45); color: #f2c948; }
  .risk-btn--hard   { background: rgba(247, 147, 26, 0.12); border-color: rgba(247, 147, 26, 0.45); color: #f7a942; }
  .risk-btn--expert { background: rgba(248, 95, 93, 0.13);  border-color: rgba(248, 95, 93, 0.45);  color: #fa7a78; }
  .risk-btn--master { background: rgba(200, 30, 58, 0.15);  border-color: rgba(200, 30, 58, 0.55);  color: #ef5e74; }

  .risk-btn--easy.active   { background: #0ECC68; border-color: #0ECC68; color: #fff; }
  .risk-btn--medium.active { background: #F7C948; border-color: #F7C948; color: #1a1400; } /* dark text — yellow needs contrast */
  .risk-btn--hard.active   { background: #F7931A; border-color: #F7931A; color: #fff; }
  .risk-btn--expert.active { background: #F85F5D; border-color: #F85F5D; color: #fff; }
  .risk-btn--master.active { background: #C81E3A; border-color: #C81E3A; color: #fff; }
  .risk-btn.active { box-shadow: 0 2px 0 0 rgba(0, 0, 0, 0.35); }

  @media (hover: hover) {
    .risk-btn--easy:hover:not(:disabled):not(.active)   { border-color: #0ECC68; color: #6cf0ad; }
    .risk-btn--medium:hover:not(:disabled):not(.active) { border-color: #F7C948; color: #ffd95e; }
    .risk-btn--hard:hover:not(:disabled):not(.active)   { border-color: #F7931A; color: #ffab4d; }
    .risk-btn--expert:hover:not(:disabled):not(.active) { border-color: #F85F5D; color: #ff8f8d; }
    .risk-btn--master:hover:not(:disabled):not(.active) { border-color: #C81E3A; color: #ff7287; }
  }

  /* Desktop/tablet: controls as a compact floating card at bottom-center (mines-style) */
  @media (min-width: 861px) {
    .row { position: relative; }
    /* board fills, reserving space for the floating card; tower-zone is 60vh */
    /* board fills the area above the controls card; tower centered inside */
    /* --side-h is kept in sync with the floating card's real height from JS */
    .board { flex: 1; min-height: 0; padding-bottom: calc(var(--side-h, 150px) + 28px); }
    /* bound the tower by the space left above the card, not the viewport */
    .tower-grid { max-height: min(100%, 560px); }
    .side {
      position: absolute;
      left: 0;
      right: 0;
      bottom: 14px;
      margin: 0 auto;
      width: min(480px, 90%);
      flex-direction: column;
      align-items: stretch;
      gap: 6px;
      padding: 8px 10px;
      background: rgba(30, 24, 69, 0.92);
      backdrop-filter: blur(12px);
      border: 1px solid var(--hairline);
      border-radius: 12px;
      z-index: 40;
      overflow: visible;
    }
    .manual-panel { flex-direction: column; gap: 6px; }
    /* bet input + chips use mines' base sizes (no desktop shrink) */
    .side .risk-label { font-size: 10px; }
    .side .risk-btn { min-height: 34px; padding: 3px 1px; }
    .side .risk-btn-label { font-size: 10px; }
    .side .risk-btn-sub { font-size: 8px; }
    .side .auto-open-btn { height: 28px; font-size: 10px; }
  }

  /* Auto section blocks */
  .auto-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(255,255,255,0.02);
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--hairline);
  }
  .auto-section-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-mid);
    text-transform: uppercase;
    letter-spacing: 0.08em;
  }
  .auto-chips {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
  }
  .auto-chip {
    flex: 1;
    min-width: 44px;
    height: 34px;
    border-radius: 6px;
    background: var(--chip-bg);
    border: 1px solid var(--toggle-border);
    color: var(--text-75);
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .auto-chip:hover { border-color: var(--accent-border); }
  .auto-chip.selected {
    background: var(--plum);
    border-color: var(--accent);
    color: var(--accent);
  }
  /* Difficulty Dropdown */
  .diff-dropdown {
    position: relative;
  }
  .diff-dropdown-btn {
    width: 100%;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    background: var(--chip-bg);
    border: 1px solid var(--toggle-border);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s;
  }
  .diff-dropdown-btn:hover { border-color: var(--accent-border); }
  .diff-dropdown-btn.open { border-color: var(--accent); }
  .diff-dropdown-arrow {
    transition: transform 0.2s;
    font-size: 10px;
    color: var(--text-mid);
  }
  .diff-dropdown-btn.open .diff-dropdown-arrow { transform: rotate(180deg); }
  .diff-dropdown-list {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: var(--panel);
    border: 1px solid var(--toggle-border);
    border-radius: 8px;
    overflow: hidden;
    z-index: 60;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  }
  .diff-dropdown-list.show { display: block; }
  .diff-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.1s;
    border-bottom: 1px solid var(--hairline);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-75);
    background: none;
    border-left: none; border-right: none; border-top: none;
    width: 100%;
  }
  .diff-dropdown-item:last-child { border-bottom: none; }
  .diff-dropdown-item:hover { background: rgba(251, 206, 4, 0.05); }
  .diff-dropdown-item.active {
    background: rgba(251, 206, 4, 0.08);
    color: var(--text);
    border-left: 2px solid var(--accent);
  }
  .diff-dropdown-icons {
    display: flex;
    gap: 2px;
  }
  .diff-dropdown-icons img {
    width: 18px;
    height: 18px;
  }

  .auto-stop-grid {
    display: flex;
    gap: 8px;
  }
  .auto-stop-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .auto-stop-item > span {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-mid);
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
  .auto-stop-input {
    height: 36px;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    background: linear-gradient(180deg, #1E1845 0%, #1E1845 100%);
    color: var(--text);
    font-family: inherit;
    font-weight: 600;
    font-size: 13px;
    padding: 0 10px;
    outline: none;
    width: 100%;
    transition: border-color 0.15s;
    -moz-appearance: textfield;
  }
  .auto-stop-input:focus { border-color: var(--accent); }
  .auto-stop-input::-webkit-outer-spin-button,
  .auto-stop-input::-webkit-inner-spin-button { -webkit-appearance: none; }
  .auto-stop-input::placeholder { color: var(--text-dimmer); font-weight: 500; }

  /* Auto start/stop */
  .auto-start-btn {
    height: 46px;
    width: 100%;
    margin-top: 4px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #F7931A 0%, #E67A00 100%);
    color: #fff;
    font-family: inherit;
    font-weight: 800;
    font-size: 13px;
    cursor: pointer;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    box-shadow: 0 4px 16px rgba(247,147,26,0.30), inset 0 1px 0 rgba(255,255,255,0.2);
    transition: all 0.2s;
  }
  .auto-start-btn:hover { transform: translateY(-1px); }
  .auto-stop-btn {
    display: none;
    height: 42px;
    border: 1.5px solid var(--red);
    border-radius: 10px;
    background: var(--red-bg);
    color: var(--red);
    font-family: inherit;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s;
  }
  .auto-stop-btn:hover { background: rgba(248, 95, 93, 0.25); }
  .app.auto-running .auto-start-btn { display: none; }
  .app.auto-running .auto-stop-btn  { display: block; }

  /* Auto Play opener + drawer (exact mines values) */
  .auto-open-btn {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    height: 32px;
    width: 100%;
    /* tinted accent fill so Auto Play clearly reads as an actionable button */
    border: 1px solid var(--accent-border);
    border-radius: 8px;
    background: var(--accent-glow);
    color: var(--text);
    font-family: inherit;
    font-weight: 700;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
  }
  .auto-open-btn svg { width: 15px; height: 15px; }
  .auto-open-btn:disabled { opacity: 0.4; cursor: not-allowed; }
  @media (hover: hover) {
    .auto-open-btn:hover:not(:disabled) {
      border-color: var(--accent);
      background: var(--accent);
      color: #fff;
    }
  }
  .auto-stop-inline {
    height: 50px;
    width: 100%;
    border: 1px solid rgba(248,95,93,0.4);
    border-radius: 10px;
    background: rgba(248,95,93,0.15);
    color: var(--red);
    font-family: inherit;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    -webkit-tap-highlight-color: transparent;
  }
  .auto-stop-inline .auto-stop-label { font-weight: 800; font-size: 14px; letter-spacing: 0.06em; }
  .auto-stop-inline .auto-stop-sub { font-size: 11px; opacity: 0.85; }
  /* Show the auto config panel when it lives inside the drawer */
  .auto-modal .auto-panel { display: flex; }
  .auto-modal-head { display: flex; align-items: center; }
  .auto-modal-head h2 { margin-bottom: 14px; }

  /* Auto progress */
  .auto-progress {
    display: none;
    flex-direction: column;
    gap: 6px;
  }
  .app.auto-running .auto-progress { display: flex; }
  .auto-stats {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-mid);
  }
  .auto-stats b { color: var(--text); }
  .profit-pos { color: var(--green) !important; }
  .profit-neg { color: var(--red) !important; }
  .auto-progress-bar {
    height: 4px;
    border-radius: 2px;
    background: var(--hairline);
    overflow: hidden;
  }
  .auto-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s;
  }

  /* ============= MAIN AREA ============= */
  .main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background: url('bg.png') center center / cover no-repeat;
  }
  .main::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 0;
    pointer-events: none;
  }
  .main > * { position: relative; z-index: 1; }

  /* Header */
  .header {
    display: flex;
    height: 50px;
    background: var(--surface);
    border-bottom: 1px solid var(--hairline);
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    flex-shrink: 0;
    z-index: 10;
  }
  .header-left {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .header-left .game-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.02em;
  }
  .header-left .game-name .ico { font-size: 18px; color: var(--accent); }
  .rgs-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border: 1px solid var(--toggle-border);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-mid);
    background: rgba(255,255,255,0.02);
    line-height: 1;
    user-select: none;
  }
  .rgs-badge.rgs-connected {
    border-color: rgba(60,200,120,0.45);
    color: #b8f0cf;
    background: rgba(60,200,120,0.08);
  }
  .rgs-badge.rgs-error {
    border-color: rgba(220,80,80,0.45);
    color: #ffb8b8;
    background: rgba(220,80,80,0.08);
  }
  .rgs-badge.rgs-connecting {
    border-color: rgba(247,147,26,0.45);
    color: #f8e082;
    background: rgba(247,147,26,0.08);
  }
  .rgs-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #6b7790;
    box-shadow: 0 0 0 2px rgba(0,0,0,0.15) inset;
  }
  .rgs-dot.rgs-ok { background: #3ecf8e; box-shadow: 0 0 6px rgba(62,207,142,0.7); }
  .rgs-dot.rgs-err { background: #e35f5f; box-shadow: 0 0 6px rgba(227,95,95,0.7); }
  .rgs-dot.rgs-pending {
    background: #F7931A;
    box-shadow: 0 0 6px rgba(247,147,26,0.7);
    animation: rgs-blink 1s ease-in-out infinite;
  }
  .rgs-dot.rgs-off { background: #6b7790; }
  @keyframes rgs-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
  }
  @media (max-width: 600px) {
    .rgs-badge .rgs-label { display: none; }
    .rgs-badge { padding: 4px 6px; }
  }
  /* Header balance + icon buttons (mines parity) */
  .header-bal {
    display: flex; align-items: center; gap: 4px;
    margin-left: auto; margin-right: 8px;
  }
  .header-bal-icon { font-size: 14px; font-weight: 700; color: var(--accent); }
  .header-bal-value { font-size: 14px; font-weight: 700; color: #fff; }
  .header-right {
    display: flex; align-items: center; gap: 6px; flex-shrink: 0;
  }
  .header-right .hdr-btn {
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; padding: 0;
    border: 1px solid var(--toggle-border); border-radius: 8px;
    background: transparent; color: var(--text-mid);
    cursor: pointer; transition: all 0.15s; flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
  }
  @media (hover: hover) {
    .header-right .hdr-btn:hover {
      border-color: var(--accent-border); color: var(--text);
      background: rgba(255,255,255,0.04);
    }
  }
  .header-right .hdr-btn svg { width: 15px; height: 15px; }
  .header-right .hdr-info { font-size: 13px; font-weight: 700; }
  /* desktop shows all icons; mobile collapses to history + dots menu */
  .hdr-desktop { display: flex !important; }
  .hdr-mobile { display: none !important; }
  .hdr-dots { position: relative; }
  .dots-menu {
    display: none; position: absolute;
    top: calc(100% + 6px); right: 0;
    background: var(--panel); border: 1px solid var(--hairline);
    border-radius: 12px; padding: 4px;
    min-width: 170px; box-shadow: 0 12px 40px rgba(0,0,0,0.5);
    z-index: 60; flex-direction: column;
  }
  .dots-menu.open { display: flex; }
  .dots-menu-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 8px;
    font-size: 12px; font-weight: 500; color: var(--text-75);
    cursor: pointer; transition: background 0.12s; white-space: nowrap;
  }
  .dots-menu-item:hover { background: rgba(255,255,255,0.05); color: var(--text); }
  .dots-menu-item svg { width: 16px; height: 16px; flex-shrink: 0; }
  .fairplay:hover { border-color: var(--accent-border); color: var(--text); }
  .info {
    width: 30px; height: 30px;
    border: 1px solid var(--toggle-border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-mid);
    cursor: pointer;
    transition: all 0.2s;
  }
  .info:hover { border-color: var(--accent-border); color: var(--text); }

  /* Side panel header — only on mobile where there's no top header */
  .side-header {
    display: none;
    flex-direction: column;
    gap: 10px;
    padding-bottom: 12px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--hairline);
  }
  .side-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .side-header-top .game-name {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
  }
  .side-header-top .game-name .ico { font-size: 14px; }
  .side-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .side-header .side-balance {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: linear-gradient(135deg, rgba(247,147,26,0.06) 0%, rgba(247,147,26,0.01) 100%);
    border: 1px solid rgba(247,147,26,0.15);
    border-radius: 8px;
  }
  .side-balance-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-mid);
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }
  .side-balance-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent);
  }

  /* ============= GAME INFO MODAL ============= */
  .modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.08);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
  }
  .modal-overlay.show { opacity: 1; pointer-events: auto; }
  .modal {
    background: var(--panel);
    border: 1px solid var(--hairline);
    border-radius: 14px;
    width: min(420px, calc(100vw - 32px));
    max-height: min(520px, 70dvh);
    overflow-y: auto;
    padding: 24px;
    position: relative;
    box-shadow: 0 24px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.06);
  }
  .modal h2 {
    font-size: 16px;
    margin-bottom: 14px;
    color: var(--text);
    font-weight: 700;
  }
  .modal h3 {
    font-size: 13px;
    color: var(--accent);
    font-weight: 700;
    margin: 12px 0 6px;
  }
  .modal p, .modal li {
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-75);
  }
  .modal ul, .modal ol { padding-left: 18px; margin-bottom: 8px; }
  .modal li { margin-bottom: 3px; }
  .modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 28px; height: 28px;
    background: var(--card-bg);
    border: 1px solid var(--hairline);
    border-radius: 8px;
    color: var(--text-mid);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .modal-payout-box {
    display: flex;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--card-bg);
    border: 1px solid var(--hairline);
    border-radius: 10px;
    margin-bottom: 8px;
  }
  .modal-payout-box .label { font-size: 12px; color: var(--text-mid); }
  .modal-payout-box .value { font-size: 13px; font-weight: 700; color: var(--accent); }
  .info-box {
    display: flex;
    gap: 10px;
    padding: 12px;
    background: var(--card-bg);
    border: 1px solid var(--hairline);
    border-radius: 10px;
    margin-bottom: 8px;
  }
  .info-box .info-icon { font-size: 20px; flex-shrink: 0; }
  .info-box p { margin: 0; }
  .mult-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 8px;
  }
  .mult-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
  }
  .mult-table th, .mult-table td {
    padding: 7px 10px;
    text-align: left;
    border-bottom: 1px solid var(--hairline);
  }
  .mult-table th { color: var(--text-mid); font-weight: 600; }
  .mult-table td { color: var(--text-75); }
  .stage-rtp-table .rtp-cell {
    color: #b8f0cf;
    font-weight: 700;
    background: rgba(60, 200, 120, 0.08);
    border-left: 1px solid rgba(60, 200, 120, 0.25);
  }

  /* Provably Fair modal */
  .pf-desc { margin-bottom: 16px; }
  .pf-section {
    background: var(--card-bg);
    border: 1px solid var(--hairline);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 8px;
  }
  .pf-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .pf-icon { font-size: 14px; }
  .pf-sublabel { font-size: 11px; color: var(--text-dim); margin-bottom: 8px; }
  .pf-toggle-row { display: flex; gap: 6px; margin-bottom: 8px; }
  .pf-toggle-btn {
    flex: 1;
    height: 32px;
    border: 1px solid var(--toggle-border);
    border-radius: 8px;
    background: transparent;
    color: var(--text-mid);
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
  }
  .pf-toggle-btn.active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--plum);
  }
  .pf-input-row { display: flex; gap: 6px; margin-bottom: 8px; }
  .pf-input-row input {
    flex: 1;
    height: 34px;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    background: linear-gradient(180deg, #1E1845 0%, #1E1845 100%);
    color: var(--text);
    font-family: monospace;
    font-size: 11px;
    padding: 0 10px;
    outline: none;
  }
  .pf-btn-sm {
    width: 34px;
    height: 34px;
    border: 1px solid var(--toggle-border);
    border-radius: 8px;
    background: rgba(255,255,255,0.03);
    color: var(--text-mid);
    font-family: inherit;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
  }
  .pf-save-btn {
    width: 100%;
    height: 32px;
    border: 1px solid var(--accent-border);
    border-radius: 8px;
    background: var(--plum);
    color: var(--accent);
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
  }
  .pf-hash-box {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--hairline);
    border-radius: 8px;
    padding: 10px;
    font-family: monospace;
    font-size: 10px;
    color: var(--text-mid);
    word-break: break-all;
    margin-bottom: 6px;
  }
  .pf-cp-row { display: flex; gap: 6px; margin-bottom: 8px; }
  .pf-note { font-size: 11px; color: var(--text-dim); margin: 0; }
  .pf-how {
    background: var(--card-bg);
    border: 1px solid var(--hairline);
    border-radius: 10px;
    padding: 16px;
  }
  .pf-how-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 10px;
  }
  .pf-how ol { padding-left: 18px; }
  .pf-how li { font-size: 11px; color: var(--text-75); margin-bottom: 5px; }

  /* ============= TOWER BOARD (mirrors mines: flex-center board → full-size
     wrapper → sized inner grid with aspect-ratio + max-height cap) ============= */
  .board {
    flex: 1;
    min-height: 0;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
  }

  /* wrapper = mines' .grid-wrap (full size, centers the grid) */
  .tower-zone {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: transparent;
  }

  /* the tower: a constant box (no aspect-ratio) capped at min(50vh,…) tall and
     a fixed max width — tiles flex to fill, so the tower size stays the same
     across difficulties (only tile width changes). */
  .tower-grid {
    height: 100%;
    max-height: min(50vh, 560px);
    width: 100%;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin: 0;
    padding: 8px;
  }

  .tower-floor {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    flex: 1;
    min-height: 0;
    opacity: 0.35;
    transition: opacity 0.3s;
    position: relative;
  }
  .tower-floor.active { opacity: 1; }
  .tower-floor.cleared { opacity: 1; }
  .tower-floor.failed { opacity: 1; }
  /* Awaiting server response: a soft breathing glow on the active floor's tiles.
     Toggled (delay-gated) from JS so a fast pick response doesn't flicker. */
  @keyframes towerAwaitGlow {
    0%, 100% { box-shadow: 0 3px 0 0 rgba(5,2,15,0.7), inset 0 1px 0 rgba(180,140,240,0.1), 0 0 0 0 rgba(247,147,26,0); border-color: var(--accent-border); }
    50%      { box-shadow: 0 3px 0 0 rgba(5,2,15,0.7), inset 0 1px 0 rgba(180,140,240,0.1), 0 0 14px 2px var(--accent-border); border-color: var(--accent); }
  }
  .tower-floor.awaiting .tile:not(.revealed) {
    animation: towerAwaitGlow 0.9s ease-in-out infinite;
  }

  .floor-mult { display: none; }

  .tower-tiles {
    display: flex;
    gap: 6px;
    justify-content: center;
    width: 100%;
    height: 100%;
  }

  .tile {
    flex: 1;
    min-width: 0;
    height: 100%;
    border-radius: 4px;
    background: rgba(20, 10, 40, 0.85);
    border: 1.5px solid rgba(160, 120, 220, 0.35);
    box-shadow: 0 3px 0 0 rgba(5, 2, 15, 0.7), inset 0 1px 0 rgba(180, 140, 240, 0.1);
    backdrop-filter: blur(6px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    transition: all 0.2s;
    position: relative;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }
  .tile:disabled { cursor: not-allowed; }
  /* Hover lift only on real pointers so it doesn't stick after a tap on touch */
  @media (hover: hover) {
    .tile:hover:not(:disabled):not(.revealed) {
      border-color: rgba(220, 180, 60, 0.6);
      box-shadow: 0 3px 0 0 rgba(5, 2, 15, 0.7), 0 0 20px rgba(220, 180, 60, 0.25), inset 0 1px 0 rgba(220, 180, 60, 0.15);
      transform: translateY(-3px);
      background: rgba(40, 20, 65, 0.9);
    }
  }
  /* Touch press feedback: shows while finger is down, releases on lift */
  .tile:active:not(:disabled):not(.revealed) {
    border-color: rgba(220, 180, 60, 0.6);
    background: rgba(40, 20, 65, 0.9);
    transform: scale(0.96);
  }
  .tile.revealed { pointer-events: none; }
  .tile.safe {
    background: rgba(5, 30, 15, 0.75);
    border-color: rgba(14, 204, 104, 0.6);
    box-shadow: 0 0 18px rgba(14, 204, 104, 0.3), inset 0 0 12px rgba(14, 204, 104, 0.08);
    flex-direction: column;
    gap: 2px;
  }
  .tile-mult {
    font-size: 11px;
    font-weight: 700;
    color: var(--green-bright);
    background: rgba(14, 204, 104, 0.15);
    border: 1px solid rgba(14, 204, 104, 0.3);
    border-radius: 4px;
    padding: 1px 6px;
    line-height: 1.3;
  }
  .tile.mine {
    background: rgba(40, 5, 15, 0.75);
    border-color: rgba(248, 95, 93, 0.6);
    box-shadow: 0 0 18px rgba(248, 95, 93, 0.3), inset 0 0 12px rgba(248, 95, 93, 0.08);
    flex-direction: column;
    gap: 2px;
  }
  .tile-mult.red {
    color: var(--red);
    background: rgba(248, 95, 93, 0.15);
    border: 1px solid rgba(248, 95, 93, 0.3);
  }
  .tile.dimmed {
    opacity: 1;
    background: rgba(15, 8, 30, 0.9);
    border-color: rgba(100, 80, 150, 0.15);
    box-shadow: none;
  }
  .tile.dimmed .pile-icon {
    filter: brightness(0.8) saturate(0);
  }
  .tile.safe-path {
    background: rgba(15, 8, 25, 0.9);
    border-color: rgba(120, 100, 170, 0.15);
    box-shadow: none;
    pointer-events: none;
    flex-direction: column;
    gap: 2px;
  }
  .tile.safe-path .pile-icon {
    display: none;
  }
  .tile.safe-path img {
    width: 55%;
    height: 55%;
    filter: brightness(0.8) saturate(0);
  }
  .tile.safe-path .tile-mult {
    color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
  }
  .tile img {
    width: 85%;
    height: 85%;
    object-fit: contain;
    pointer-events: none;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
  }
  .tile .pile-icon {
    width: 100%;
    height: 100%;
    object-fit: fill;
    opacity: 0.85;
    filter: brightness(1.8) drop-shadow(0 2px 4px rgba(0,0,0,0.3));
  }
  .tile.revealed .pile-icon {
    display: none;
  }
  .tile.safe img {
    filter: drop-shadow(0 0 8px rgba(14, 204, 104, 0.5));
    width: 55%;
    height: 55%;
  }
  .tile.mine img {
    filter: drop-shadow(0 0 8px rgba(248, 95, 93, 0.5));
    width: 55%;
    height: 55%;
  }

  .tower-floor.active .tile:not(:disabled):not(.revealed) {
    border-color: rgba(160, 120, 220, 0.45);
  }
  /* Gem found — instant reveal with green glow pulse */
  @keyframes gemGlow {
    0%, 100% { box-shadow: 0 0 12px rgba(14,204,104,0.25), inset 0 0 8px rgba(14,204,104,0.05); }
    50% { box-shadow: 0 0 24px rgba(14,204,104,0.5), inset 0 0 12px rgba(14,204,104,0.1); }
  }
  .tile.safe::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 10px;
    animation: gemGlow 1.5s ease-in-out infinite;
    pointer-events: none;
  }

  /* Status */
  .status {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    font-weight: 500;
    color: var(--text-75);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    z-index: 5;
    pointer-events: none;
    background: rgba(20,27,34,0.8);
    backdrop-filter: blur(6px);
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--hairline);
    white-space: nowrap;
  }

  /* ============= BOTTOM BAR ============= */
  .bottom {
    height: 44px; background: var(--surface);
    border-top: 1px solid var(--hairline);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px; flex-shrink: 0;
  }
  .bottom-icons { display: flex; gap: 14px; align-items: center; }
  .ic { color: rgba(255,255,255,0.7); cursor: pointer; display: flex; align-items: center; transition: color 0.2s, transform 0.15s; }
  .ic:hover { color: #fff; transform: scale(1.1); }
  .ic.muted { color: var(--red); }
  .ic.faved { color: var(--accent); }
  .ic.faved svg { fill: var(--accent); }
  .bottom-logo { font-size: 13px; font-weight: 700; color: rgba(255,255,255,0.4); letter-spacing: 0.12em; }

  /* ============= RESULT BADGE (center badge overlay) ============= */
  .result-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 16px 40px;
    border-radius: 14px;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 1px;
    white-space: nowrap;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
  }
  .result-badge.win {
    color: #fff;
    background: var(--green);
    animation: resultFade 0.3s ease;
  }
  .result-badge.lose {
    color: #fff;
    background: var(--red);
    animation: resultFade 0.3s ease;
  }
  .result-badge.cashout {
    color: #fff;
    background: var(--green);
    animation: resultFade 0.3s ease;
  }
  @keyframes resultFade {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
    100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  }

  /* ===========================================================
     TABLET LAYOUT (861-1168px)
     Side panel on left like desktop, but narrower
     =========================================================== */
  @media (max-width: 1168px) and (min-width: 861px) {
    .app {
      width: 100%; height: 100dvh;
      border-radius: 0; box-shadow: none;
    }
    /* No sidebar: header stays in-flow at top, controls bar spans the bottom */
    .side { padding: 12px 16px; gap: 10px; }
    .tower-grid { gap: 3px; padding: 6px; }
    .tower-tiles { gap: 5px; }
  }

  /* ===========================================================
     PHONE LAYOUT (<=860px)
     Stack vertically, header & bottom bar fixed
     =========================================================== */
  @media (max-width: 860px) {
    .app {
      width: 100%; height: 100dvh;
      border-radius: 0; box-shadow: none;
    }
    .header {
      display: flex;
      position: fixed;
      top: 0; left: 0; right: 0;
      z-index: 50;
    }
    .side-header { display: none; }
    /* board fills available space; controls pinned at bottom, no scroll */
    .row {
      flex-direction: column;
      overflow: hidden;
    }
    .main { order: 1; flex: 1; min-height: 0; overflow: hidden; padding-top: 50px; background: var(--board); }
    /* Mobile: hide the bg image (and its dim overlay) */
    .main::before { display: none; }

    /* Mobile: tiles stay height-driven (flex fill) so all 8 floors share the
       50vh tower and none get clipped. "Slightly less wide" is achieved by
       narrowing the whole tower (.tower-grid max-width below), not via
       aspect-ratio — which would make the stack overflow and clip a floor. */
    .tile {
      flex: 1 1 0;
      min-width: 0;
      width: auto;
      height: 100%;
      aspect-ratio: auto;
    }
    .side {
      order: 2;
      flex: 0 0 auto;
      width: 100%;
      border-right: none;
      border-top: 1px solid var(--hairline);
      padding: 10px 14px 12px;
      gap: 6px;
      overflow: visible;
    }

    .header { padding: 0 10px; }
    .hdr-desktop { display: none !important; }
    .hdr-mobile { display: flex !important; }
    .header-bal-value { font-size: 13px; }
    .fairplay { font-size: 0; padding: 6px 8px; gap: 0; }
    .fairplay::before { width: 12px; height: 14px; }
    .header-right .info { width: 26px; height: 26px; font-size: 10px; }

    .board { flex: 1; min-height: 0; }
    .status { display: none; }
    /* Narrower tower → slightly-less-wide tiles, without touching tile height
       (keeps all 8 floors visible). Centered by .tower-zone. */
    .tower-grid { gap: 3px; padding: 8px 12px; max-width: 300px; }
    .tower-tiles { gap: 5px; }
    .tile { border-radius: 4px; }

    /* Revealed tiles — constrained on mobile */
    .tile.safe, .tile.mine {
      flex-direction: row;
      gap: 2px;
      overflow: hidden;
    }
    .tile.safe img, .tile.mine img {
      width: auto;
      height: 60%;
      max-height: 24px;
      flex-shrink: 0;
      object-fit: contain;
    }
    .tile-mult {
      font-size: 9px;
      padding: 1px 3px;
      white-space: nowrap;
    }
    .tile.safe-path {
      flex-direction: row;
      overflow: hidden;
    }
    .tile.safe-path img {
      width: auto;
      height: 50%;
      max-height: 20px;
      object-fit: contain;
    }

    /* Prevent floors from stretching on reveal */
    .tower-floor {
      flex: 1;
      min-height: 0;
      overflow: hidden;
    }
    .tower-tiles {
      height: 100%;
      overflow: hidden;
    }
    .tile {
      overflow: hidden;
      min-height: 0;
    }

    /* Reorder side panel on mobile */
    .side { display: flex; flex-direction: column; }
    .mode-toggle { order: 4; }
    .manual-panel { display: flex; flex-direction: column; }
    .manual-bet-section { order: 2; }
    .manual-risk-section { order: 3; }
    .place-btn { order: 1; }
    .cashout-btn { order: 1; }

    .bottom { display: none; }

    .result-badge { font-size: 16px; padding: 12px 28px; }

    /* How-to-Play / Provably-Fair etc. dock to the bottom as a slide-up sheet */
    .modal-overlay { align-items: flex-end; }
    .modal {
      width: 100%;
      max-width: 100%;
      max-height: 85dvh;
      padding: 16px 16px 24px;
      border-radius: 16px 16px 0 0;
      transform: translateY(100%);
      transition: transform 0.28s ease;
    }
    .modal-overlay.show .modal { transform: translateY(0); }
    /* .free-bet-summary sets max-width:360px globally — override so the
       auto-play / free-bet result modal is a full-width bottom sheet on mobile. */
    .modal.free-bet-summary { width: 100%; max-width: 100%; }
    .modal h2 { font-size: 15px; margin-bottom: 10px; }
    .modal h3 { font-size: 12px; margin: 8px 0 4px; }
    .modal p, .modal li { font-size: 11px; line-height: 1.4; }
    .mult-table { font-size: 10px; }
    .mult-table th, .mult-table td { padding: 3px 5px; }
    .modal-payout-box { padding: 6px 10px; }
    .pf-section { padding: 8px; margin-bottom: 6px; }
    .pf-input-row input { font-size: 10px; height: 28px; }
    .pf-btn-sm { width: 28px; height: 28px; }
  }

  /* ===========================================================
     SMALL PHONES (<=480px) — extra compact
     =========================================================== */
  @media (max-width: 480px) {
    .tower-grid { gap: 2px; padding: 6px 10px; }
    .tower-tiles { gap: 4px; }
    .side { padding: 10px 14px; }

    .modal {
      width: 100%;
      max-width: 100%;
      max-height: 88dvh;
      padding: 14px 14px 22px;
    }
    .modal h2 { font-size: 14px; }
    .modal p, .modal li { font-size: 10px; }
    .mult-table { font-size: 9px; }
    .mult-table th, .mult-table td { padding: 2px 3px; }
  }

  /* ===========================================================
     LANDSCAPE PHONES — side-by-side, everything fits in viewport
     =========================================================== */
  @media (max-height: 500px) and (orientation: landscape) and (min-width: 500px) {
    .app {
      width: 100%; height: 100dvh;
      border-radius: 0; box-shadow: none;
    }
    .header {
      display: flex;
      position: fixed;
      top: 0; left: 0; right: 0;
      height: 32px;
      padding: 0 10px;
      z-index: 50;
      background: var(--panel);
    }
    .header-left .game-name { font-size: 11px; }
    .header-left .game-name .ico { font-size: 12px; }
    .header-left .game-name span:last-child { display: none; }
    .header-balance { padding: 2px 8px 2px 6px; }
    .header-bal-icon { font-size: 9px; width: 14px; height: 14px; }
    .header-bal-value { font-size: 10px; }
    .fairplay { font-size: 0; padding: 3px 5px; gap: 0; }
    .fairplay::before { width: 9px; height: 11px; }
    .header-right .info { width: 22px; height: 22px; font-size: 9px; }
    .side-header { display: none; }

    .row {
      flex-direction: row !important;
      overflow: hidden;
      padding-top: 32px;
    }
    .main { order: 0 !important; flex: 1 1 auto !important; min-width: 0 !important; padding-top: 0; }
    .side {
      order: 1 !important;
      width: 300px !important;
      flex: 0 0 300px !important;
      border-left: 1px solid var(--hairline) !important;
      border-right: none !important;
      border-top: none !important;
      background: #23204e !important;
      padding: 10px 12px !important;
      gap: 8px !important;
      overflow-y: auto;
      overflow-x: hidden;
      justify-content: flex-start !important;
      -webkit-overflow-scrolling: touch;
    }
    /* RISK: keep all 5 buttons fitting, no clip */
    .side .risk-options { grid-template-columns: repeat(5, 1fr) !important; gap: 4px !important; }
    .side .risk-btn { min-width: 0 !important; min-height: 38px !important; padding: 4px 1px !important; }
    .side .risk-btn-label { font-size: 10px !important; }
    .side .risk-btn-sub { font-size: 8px !important; }
    /* Bet block: stepper (left) + 1/5/10/Max horizontal row (right), label spans top */
    .side .stake-bet { flex-direction: column !important; align-items: stretch !important; gap: 8px !important; }
    .side .stake-left { display: grid !important; grid-template-columns: minmax(0,1fr) minmax(0,1.25fr) !important; align-items: center !important; gap: 6px !important; }
    .side .risk-label { grid-column: 1 / -1 !important; margin: 0 !important; }
    .side .stake-input { grid-column: 1 !important; width: auto !important; min-width: 0 !important; height: 44px !important; }
    .side .stake-chips { grid-column: 2 !important; display: grid !important; grid-template-columns: repeat(4, 1fr) !important; gap: 4px !important; }
    .side .stake-chip { height: 44px !important; min-width: 0 !important; padding: 0 !important; font-size: 13px !important; }
    .side .place-btn { width: 100% !important; height: 46px !important; min-height: 0 !important; align-self: stretch !important; flex-direction: row !important; align-items: center !important; justify-content: center !important; gap: 8px !important; font-size: 14px !important; box-shadow: 0 2px 10px rgba(247,147,26,0.28) !important; }
    .side .auto-open-btn { width: 100% !important; }
    /* Tower grid: fill the board height (50vh cap made it tiny in landscape) */
    .main .tower-grid { max-height: none !important; height: 100% !important; max-width: min(440px, 100%) !important; }
    /* Drawers: centered, fit, scroll */
    .drawer-backdrop { align-items: center !important; }
    .drawer { width: min(600px,92vw) !important; max-width: 600px !important; max-height: 90dvh !important; border-radius: 16px !important; }
    .drawer-body { max-height: none !important; }
    /* Modals: centered + compact, not a cut-off bottom sheet */
    .modal-overlay { align-items: center !important; }
    .modal::before { display: none !important; }
    .fbs-icon { width: 40px !important; height: 40px !important; margin-bottom: 4px !important; }
    .fbs-icon svg { width: 22px !important; height: 22px !important; }
    .fbs-stats, .fbs-stats-3 { margin-bottom: 10px !important; }
    .fbs-winnings { padding: 10px !important; margin-bottom: 10px !important; }
    .fbs-winnings-val { font-size: 22px !important; }

    .mode-toggle { padding: 3px; }
    .mode-toggle button { height: 30px; font-size: 11px; }
    .label { font-size: 11px; }
    .input-row { height: 38px; border-radius: 6px; }
    .input-row input { font-size: 14px; }
    .input-row .currency { font-size: 12px; width: 28px; }
    .input-row .chip { width: 34px; height: 26px; font-size: 10px; border-radius: 5px; }
    .place-btn, .cashout-btn { height: 38px; font-size: 12px; border-radius: 6px; }
    .auto-start-btn, .auto-stop-btn { height: 36px; font-size: 12px; border-radius: 6px; }
    .auto-section { padding: 8px 10px; border-radius: 6px; }
    .auto-section-label { font-size: 9px; margin-bottom: 5px; }
    .auto-chip { padding: 5px 4px; font-size: 10px; }
    .auto-stop-input { height: 28px; font-size: 11px; }
    .bet-amount-wrap { padding-top: 0; gap: 4px; }
    .manual-panel { gap: 8px; }

    .board { flex: 1; display: flex; flex-direction: column; }
    .tower-grid { gap: 2px; padding: 4px; }
    .tower-tiles { gap: 3px; }
    .tile { border-radius: 3px; }

    .result-badge { font-size: 14px; padding: 10px 22px; }

    .modal {
      width: min(400px, calc(100vw - 24px));
      max-height: 90dvh;
      padding: 16px;
    }
    .modal h2 { font-size: 15px; margin-bottom: 10px; }
    .modal p, .modal li { font-size: 11px; }
    .mult-table { font-size: 9px; }
    .mult-table th, .mult-table td { padding: 3px 4px; }
  }

/* ===== FREE BET ===== */
.free-bet-banner {
  background: linear-gradient(135deg, rgba(247,147,26,0.15) 0%, rgba(247,147,26,0.05) 100%);
  border: 1px solid rgba(247,147,26,0.35);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.free-bet-icon { font-size: 20px; }
.free-bet-info { flex: 1; }
.free-bet-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.free-bet-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-mid);
  margin-top: 2px;
}
.free-bet-progress {
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}
.free-bet-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
}
.place-btn.free-mode {
  background: linear-gradient(135deg, #F7931A 0%, #E67A00 100%);
  animation: freeBetPulse 2s ease-in-out infinite;
}
@keyframes freeBetPulse {
  0%, 100% { box-shadow: 0 4px 16px rgba(247,147,26,0.30), inset 0 1px 0 rgba(255,255,255,0.2); }
  50% { box-shadow: 0 8px 32px rgba(247,147,26,0.50), inset 0 1px 0 rgba(255,255,255,0.2); }
}
.input-row.locked {
  opacity: 0.6;
  pointer-events: none;
  border-color: rgba(247,147,26,0.3);
}

/* ===== Free Bet Summary Modal ===== */
.free-bet-summary { text-align: center; max-width: 360px; }
.fbs-icon { font-size: 48px; margin-bottom: 8px; }
.free-bet-summary h2 { margin-bottom: 16px; }
.fbs-stats { display: flex; gap: 8px; margin-bottom: 16px; }
.fbs-stat { flex: 1; background: var(--card-bg); border: 1px solid var(--hairline); border-radius: 10px; padding: 10px 8px; display: flex; flex-direction: column; align-items: center; }
.fbs-stat-label { font-size: 9px; font-weight: 600; color: var(--text-dimmer); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.fbs-stat-val { font-size: 15px; font-weight: 800; }
.fbs-stat-val.accent { color: var(--accent); }
.fbs-winnings { display: flex; flex-direction: column; align-items: center; padding: 16px; background: linear-gradient(135deg, rgba(247,147,26,0.12) 0%, rgba(247,147,26,0.04) 100%); border: 1px solid rgba(247,147,26,0.3); border-radius: 12px; }
.fbs-winnings-label { font-size: 11px; font-weight: 600; color: var(--text-mid); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.fbs-winnings-val { font-size: 28px; font-weight: 800; color: var(--accent); }
.fbs-btn {
  display: block;
  width: 100%;
  height: 50px;
  margin-top: 16px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #F7931A 0%, #E67A00 100%);
  color: #fff;
  font-family: inherit;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  box-shadow: 0 4px 16px rgba(247,147,26,0.30), inset 0 1px 0 rgba(255,255,255,0.2);
  transition: all 0.2s;
}
.fbs-btn:hover {
  filter: brightness(1.08);
  box-shadow: 0 6px 24px rgba(247,147,26,0.40), inset 0 1px 0 rgba(255,255,255,0.2);
  transform: translateY(-1px);
}

/* ===== Free Bet Welcome Modal ===== */
.free-bet-welcome { text-align: center; max-width: 360px; }
.fbw-icon { font-size: 56px; margin-bottom: 12px; animation: fbwBounce 0.6s ease-out; }
@keyframes fbwBounce { 0% { transform: scale(0); opacity: 0; } 50% { transform: scale(1.2); } 100% { transform: scale(1); opacity: 1; } }
.fbw-desc { font-size: 15px; color: var(--text-mid); line-height: 1.5; margin-bottom: 4px; }
.fbw-hl { color: var(--accent); font-weight: 800; }
.fbw-sub { font-size: 13px; color: var(--text-mid); line-height: 1.6; margin-bottom: 18px; }
.fbw-sub strong { color: var(--text); font-weight: 800; }
.fbs-played { font-size: 14px; color: var(--text-mid); margin-bottom: 14px; }
.fbs-played strong { color: var(--text); font-weight: 800; }
.fbs-total { font-size: 20px; font-weight: 800; white-space: nowrap; margin: 4px 0 16px; }
.fbw-count { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px; background: linear-gradient(135deg, rgba(247,147,26,0.12) 0%, rgba(247,147,26,0.04) 100%); border: 1px solid rgba(247,147,26,0.3); border-radius: 12px; }
.fbw-count-num { font-size: 40px; font-weight: 800; color: var(--accent); line-height: 1; }
.fbw-count-label { font-size: 13px; font-weight: 700; color: var(--text-mid); text-transform: uppercase; letter-spacing: 0.06em; }
.fbw-btn {
  display: block;
  width: 100%;
  height: 50px;
  margin-top: 16px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #F7931A 0%, #E67A00 100%);
  color: #fff;
  font-family: inherit;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  box-shadow: 0 4px 16px rgba(247,147,26,0.30), inset 0 1px 0 rgba(255,255,255,0.2);
  transition: all 0.2s;
  animation: freeBetPulse 2s ease-in-out infinite;
}
.fbw-btn:hover {
  filter: brightness(1.08);
  box-shadow: 0 6px 24px rgba(247,147,26,0.40), inset 0 1px 0 rgba(255,255,255,0.2);
  transform: translateY(-1px);
}

/* ====================================================================
   Drawer shell + content primitives (ported from mines)
   ==================================================================== */
/* Boot loading screen (matches limbo/mines/rps) */
.loading-screen { position: fixed; inset: 0; z-index: 9999; background: var(--board, #120D24); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.loading-content { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.loading-logo { width: 80px; height: auto; }
.loading-bar-wrap { width: 160px; height: 3px; background: rgba(255,255,255,0.08); border-radius: 3px; overflow: hidden; margin-top: 8px; }
.loading-bar { width: 100%; height: 100%; background: #F7931A; border-radius: 3px; animation: loading-fill 2.5s ease forwards; }
@keyframes loading-fill { 0% { width: 0%; } 100% { width: 100%; } }
.loading-text { font-size: 11px; color: rgba(255,255,255,0.35); margin-top: 4px; }

.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.08);
  z-index: 200;
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease;
}
.drawer-backdrop.show { opacity: 1; pointer-events: auto; }
.drawer-backdrop.show .drawer { transform: translateY(0); }
.drawer {
  width: 100%; max-width: 480px; max-height: 85dvh;
  display: flex; flex-direction: column;
  background: var(--panel);
  border-radius: 16px 16px 0 0;
  overflow: hidden; /* clip header/body/footer to the rounded corners */
  transform: translateY(100%);
  transition: transform 0.25s ease;
}
/* Pinned action footer (Auto Play Start/Stop) — stays visible in short iframe
   viewports instead of scrolling out of view. */
.drawer-footer {
  flex-shrink: 0;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--hairline);
  background: var(--panel);
}
.drawer-footer .auto-start-btn,
.drawer-footer .auto-stop-btn { margin: 0; width: 100%; }
.drawer-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px; height: 56px; box-sizing: border-box; flex-shrink: 0;
  border-radius: 16px 16px 0 0;
}
.drawer-title { font-weight: 600; font-size: 14px; color: var(--text); }
.drawer-close {
  width: 36px; height: 36px;
  display: flex; justify-content: center; align-items: center;
  background: none; border: none; border-radius: 10px;
  cursor: pointer; color: var(--text-mid);
}
.drawer-close:active { background: rgba(255,255,255,0.06); }
.drawer-close svg { width: 18px; height: 18px; }
.drawer-tabs {
  display: flex; align-items: center; padding: 4px;
  margin: 0 16px 12px;
  background: var(--board); border: 1px solid var(--hairline); border-radius: 14px;
}
.drawer-tab {
  flex: 1; height: 32px;
  display: flex; justify-content: center; align-items: center;
  border: none; border-radius: 10px; background: transparent;
  cursor: pointer; font-weight: 400; font-size: 12px; color: var(--text-mid);
  font-family: inherit;
}
.drawer-tab.active {
  background: var(--card-bg); color: var(--text);
  box-shadow: 0 1px 0 var(--card-shadow); font-weight: 500;
}
.drawer-body {
  overflow-y: auto; flex: 1;
  padding: 4px 16px 16px;
}
.drawer-body::-webkit-scrollbar { width: 3px; }
.drawer-body::-webkit-scrollbar-track { background: transparent; }
.drawer-body::-webkit-scrollbar-thumb { background: rgba(145,159,192,0.15); border-radius: 2px; }

/* Drawer → centered modal on desktop */
@media (min-width: 681px) {
  .drawer-backdrop { align-items: center; }
  .drawer-backdrop.show .drawer { transform: scale(1); }
  .drawer {
    max-width: 480px; max-height: 70dvh; border-radius: 16px;
    transform: scale(0.9); opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
  }
  .drawer-backdrop.show .drawer { opacity: 1; }
  .drawer-header { border-radius: 16px 16px 0 0; }
  .drawer-body { border-radius: 0 0 16px 16px; }
}

/* Drawer content primitives */
.drw-text { font-size: 12px; line-height: 1.6; color: var(--text-75); }
.drw-card {
  background: rgba(0,0,0,0.2); border-radius: 16px;
  padding: 14px; display: flex; flex-direction: column; gap: 10px;
  margin-bottom: 10px;
}
.drw-card:last-child { margin-bottom: 0; }
.drw-card-title { font-weight: 500; font-size: 13px; color: var(--text); text-align: center; }
.drw-stat-row {
  display: flex; justify-content: space-between; align-items: center; height: 28px;
}
.drw-stat-label { font-size: 12px; color: var(--text-mid); }
.drw-stat-value { font-size: 12px; font-weight: 600; color: var(--text); }
.drw-stat-value.green { color: var(--green); }
.drw-steps {
  display: flex; flex-direction: column; gap: 2px;
  background: rgba(0,0,0,0.2); border-radius: 14px; padding: 12px;
}
.drw-step { display: flex; gap: 10px; align-items: center; }
.drw-step-num {
  width: 24px; height: 24px; min-width: 24px;
  border-radius: 50%; background: var(--accent); color: var(--board);
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.drw-step-text { flex: 1; font-size: 12px; line-height: 1.5; color: var(--text-75); }
.drw-step-arrow { display: flex; padding: 0 12px; }
.drw-step-arrow-line { width: 0; height: 12px; border-left: 1px dashed var(--text-dim); }

/* PF drawer inputs */
.drw-input {
  display: flex; align-items: center; gap: 10px;
  min-height: 52px; background: var(--board);
  border: 1px solid var(--hairline); border-radius: 14px;
  padding: 8px 10px 8px 14px; box-sizing: border-box; width: 100%;
}
.drw-input:focus-within { border-color: var(--accent-border); }
.drw-input-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.drw-input-label { font-size: 10px; color: var(--text-mid); line-height: 1.4; }
.drw-input-value {
  font-size: 13px; color: var(--text); background: none; border: none;
  outline: none; padding: 0; width: 100%; font-family: inherit;
}
.drw-input-value.mono { font-family: monospace; font-size: 11px; word-break: break-all; }
.drw-input-value.green { color: var(--green); }
.drw-input-btn {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; min-width: 32px;
  background: var(--card-bg); border: none; border-radius: 10px;
  cursor: pointer; color: var(--text-mid);
}
.drw-input-btn:active { transform: scale(0.92); }
.drw-input-btn svg { width: 14px; height: 14px; }
.drw-save-btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 44px;
  background: rgba(255,255,255,0.08); border: 1px solid var(--hairline); border-radius: 12px;
  font-weight: 600; font-size: 13px; color: var(--text); cursor: pointer;
  font-family: inherit; transition: all 0.15s;
}
.drw-save-btn:hover { background: rgba(255,255,255,0.12); }
.drw-save-btn:disabled { opacity: 0.4; cursor: default; }

/* ===== HISTORY LIST ===== */
.hist-list { display: flex; flex-direction: column; gap: 6px; }
.hist-item {
  background: var(--elevated); border-radius: 14px;
  overflow: hidden; cursor: pointer; transition: background 0.12s;
}
.hist-item:hover { background: #2f2c66; }
.hist-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 8px 8px 4px; width: 100%; box-sizing: border-box;
}
.hist-left { display: flex; align-items: center; min-width: 0; flex-shrink: 1; }
.hist-icon {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; min-width: 36px; border-radius: 10px;
}
.hist-icon svg { width: 18px; height: 18px; }
.hist-info { display: flex; flex-direction: column; justify-content: center; margin-left: 2px; }
.hist-info-title { font-weight: 500; font-size: 13px; line-height: 1.4; color: var(--text); white-space: nowrap; }
.hist-info-sub { font-weight: 400; font-size: 10px; line-height: 1.4; color: var(--text-mid); white-space: nowrap; }
.hist-right { display: flex; align-items: center; flex-shrink: 0; margin-left: auto; }
.hist-chips { display: flex; align-items: center; gap: 6px; }
.hist-mult-chip {
  display: flex; align-items: center; justify-content: center;
  height: 24px; min-width: 48px; padding: 4px 8px;
  background: var(--card-bg); border-radius: 8px;
  box-shadow: 0 1px 0 var(--card-shadow);
  font-weight: 500; font-size: 11px; line-height: 1; color: var(--text-75);
  white-space: nowrap;
}
.hist-payout-chip {
  display: flex; align-items: center; justify-content: center;
  height: 24px; min-width: 64px; padding: 4px 8px;
  border-radius: 8px; font-weight: 600; font-size: 11px; line-height: 1; white-space: nowrap;
}
.hist-payout-chip--win { background: var(--green-bg); color: var(--green); }
.hist-payout-chip--lose { background: var(--red-bg); color: var(--red); }
.hist-chevron {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; margin-left: 4px;
}
.hist-chevron svg { width: 14px; height: 14px; }
.hist-details { padding: 0 8px 8px; width: 100%; box-sizing: border-box; }
.hist-details-inner {
  display: flex; flex-direction: column; gap: 10px;
  background: rgba(0,0,0,0.18); border-radius: 10px; padding: 10px 12px;
}
.hist-seeds { display: flex; flex-direction: column; gap: 8px; }
.hist-seed-group { display: flex; flex-direction: column; }
.hist-seed-label { font-weight: 500; font-size: 10px; line-height: 1.4; color: var(--text-mid); }
.hist-seed-value {
  font-weight: 400; font-size: 11px; line-height: 1.4; color: var(--text-75);
  word-break: break-all; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.hist-verify-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; height: 36px; background: rgba(255,255,255,0.06);
  border: 1px solid var(--hairline); border-radius: 8px;
  color: var(--text-75); font-size: 12px; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: all 0.15s;
}
.hist-verify-btn:hover { border-color: var(--accent-border); color: var(--text); }
.hist-verify-btn:disabled { opacity: 0.5; cursor: default; }
.hist-verify-btn svg { width: 16px; height: 16px; }
.hist-pager {
  display: flex; justify-content: center; align-items: center;
  gap: 10px; margin-top: 12px; padding-top: 10px;
  border-top: 1px solid var(--hairline);
}
.hist-pager-btn {
  width: 28px; height: 28px; border-radius: 8px;
  border: 1px solid var(--toggle-border); background: transparent;
  color: var(--text-mid); font-size: 13px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; font-family: inherit;
}
.hist-pager-btn:hover:not(:disabled) { border-color: var(--accent-border); color: var(--text); }
.hist-pager-btn:disabled { opacity: 0.2; cursor: default; }
.hist-pager-info { font-size: 11px; color: var(--text-mid); min-width: 40px; text-align: center; }
.hist-empty, .hist-loading {
  text-align: center; padding: 40px 0; color: var(--text-dim); font-size: 12px;
}

/* ===== AUTO PLAY CHIPS ===== */

/* ===== Auto-play summary — SVG icon badge + win/lose tint ===== */
.fbs-icon {
  width: 60px; height: 60px; margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 16px;
  background: rgba(247,147,26,0.14);
  border: 1px solid rgba(247,147,26,0.30);
  color: var(--accent);
  font-size: 30px; line-height: 1;
}
.fbs-icon svg { width: 28px; height: 28px; }
.fbs-icon-win { background: rgba(14,204,104,0.14); border-color: rgba(14,204,104,0.32); color: var(--green); }
.fbs-icon-lose { background: rgba(248,95,93,0.14); border-color: rgba(248,95,93,0.32); color: var(--red); }

/* ===== Free Rounds — compact tag (replaces the old banner + progress bar) ===== */
.free-round-tag {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; margin-bottom: 12px;
  background: linear-gradient(135deg, rgba(247,147,26,0.15) 0%, rgba(247,147,26,0.05) 100%);
  border: 1px solid rgba(247,147,26,0.35);
  border-radius: 10px; font-size: 12px;
}
.free-round-ico { display: flex; align-items: center; color: var(--accent); }
.free-round-ico svg { width: 16px; height: 16px; }
.free-round-text { font-weight: 800; color: var(--accent); text-transform: uppercase; letter-spacing: 0.04em; }
.free-round-count { font-weight: 700; color: var(--text); }
.free-round-profit { margin-left: auto; font-weight: 800; font-variant-numeric: tabular-nums; }
.free-round-profit.pos { color: var(--green); }
.free-round-profit.neg { color: var(--red); }
/* Free Round indicator occupying the bet-input slot — same size; layout & button unchanged */
.free-round-slot {
  flex: 1; min-width: 0; grid-column: 1 / -1;
  display: flex; flex-direction: column; justify-content: center; gap: 4px;
  padding: 6px 14px;
  background: linear-gradient(135deg, rgba(247,147,26,0.15) 0%, rgba(247,147,26,0.05) 100%);
  border: 1px solid rgba(247,147,26,0.35);
  border-radius: 10px;
}
.frs-row1 { display: flex; align-items: center; gap: 8px; }
.frs-row1 .free-round-ico { display: flex; align-items: center; color: var(--accent); }
.frs-row1 .free-round-ico svg { width: 16px; height: 16px; }
.frs-label { font-weight: 800; color: var(--accent); text-transform: uppercase; letter-spacing: 0.04em; font-size: 10px; }
.frs-amount { margin-left: auto; font-weight: 700; color: var(--text-mid); font-size: 12px; font-variant-numeric: tabular-nums; }
.frs-count { margin-left: auto; font-weight: 700; color: var(--text); font-size: 13px; font-variant-numeric: tabular-nums; }
.frs-row2 { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-mid); font-weight: 600; white-space: nowrap; }
.frs-tw { margin-left: auto; }
.frs-bet { color: var(--text); font-weight: 700; }
.frs-row2 b { color: var(--green); font-weight: 800; font-variant-numeric: tabular-nums; }

/* Bet Amount panel dimmed + locked during free rounds */
.stake-left.free-locked { opacity: 0.5; pointer-events: none; cursor: not-allowed; }

/* Gift icon badge (welcome) + sizing — replaces the emoji */
.fbw-icon {
  width: 64px; height: 64px; margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 18px;
  background: rgba(247,147,26,0.14); border: 1px solid rgba(247,147,26,0.30);
  color: var(--accent);
}
.fbw-icon svg { width: 34px; height: 34px; }
.fbs-winnings.fbs-win { background: linear-gradient(135deg, rgba(14,204,104,0.14), rgba(14,204,104,0.04)); border-color: rgba(14,204,104,0.30); }
.fbs-winnings.fbs-lose { background: linear-gradient(135deg, rgba(248,95,93,0.14), rgba(248,95,93,0.04)); border-color: rgba(248,95,93,0.30); }

/* Free-round welcome / summary / auto-summary: flex column so the action button
   sits in normal flow BELOW the content (never overlapping the Net Profit value).
   Taller max-height keeps it on-screen without scrolling in short / iframe viewports. */
.modal.free-bet-welcome,
.modal.free-bet-summary { display: flex; flex-direction: column; max-height: min(560px, 88dvh); }
.modal .fbw-btn,
.modal .fbs-btn { flex-shrink: 0; }
