/* ============================================================
   Push/Fold Nash Solver — component styles
   Every rule is scoped under .pd-pushbot. No :root, no bare
   element selectors, no unprefixed classes — nothing leaks out.
   Tokens: app/static/css/tokens.css
   ============================================================ */

.pd-pushbot,
.pd-pushbot *,
.pd-pushbot *::before,
.pd-pushbot *::after { margin: 0; padding: 0; box-sizing: border-box; }

.pd-pushbot {
  /* Surfaces, text, type — mapped onto Design System v3 tokens.
     --radius and --radius-sm are deliberately NOT declared here: the
     site tokens (2px inputs, 4px panels) are referenced directly so
     nothing can shadow them. */
  --bg-body: var(--color-bg);
  --bg-panel: var(--color-surface);
  --bg-input: var(--color-surface-2);
  --bg-hover: var(--color-surface-3);
  --bg-active: var(--color-positive-subtle);
  --border: var(--color-border);
  --border-hover: var(--color-border-heavy);
  --text: var(--color-text-primary);
  --text-dim: var(--color-text-secondary);
  --text-muted: var(--color-text-muted);
  --font: var(--font-sans);
  --mono: var(--font-mono);

  /* Action encoding. Two hues, validated colorblind-safe against a
     light surface (green + purple: CVD dE 13.9, normal dE 25.5).
     Do not substitute — green+red and green+gold both fail. */
  --green: var(--color-positive);           /* push / jam  #1B6B3A */
  --green-dark: rgba(27, 107, 58, 0.35);    /* green-tinted rule */
  --green-hover: #14512C;
  --green-ink: #0F3D21;                     /* text over a push fill */
  --pushbot-raise: #8B4A9C;                 /* raise */
  --amber: var(--pushbot-raise);
  --raise-ink: #4A2454;                     /* text over a raise fill */
  --red: var(--color-text-muted);           /* fold is neutral, never red */
  --purple: var(--color-accent);            /* user override / edit mode */

  /* Three-step strength ramp per hue. Alphas are raised from the
     original dark-background values so each step separates on the
     light cell surface (#F2F1EE) and from its neighbours. */
  --push-1: rgba(27, 107, 58, 0.18);
  --push-2: rgba(27, 107, 58, 0.34);
  --push-3: rgba(27, 107, 58, 0.52);
  --push-line: rgba(27, 107, 58, 0.38);
  --push-line-strong: rgba(27, 107, 58, 0.62);
  --raise-1: rgba(139, 74, 156, 0.18);
  --raise-2: rgba(139, 74, 156, 0.34);
  --raise-3: rgba(139, 74, 156, 0.52);
  --raise-line: rgba(139, 74, 156, 0.38);
  --raise-line-strong: rgba(139, 74, 156, 0.62);
  --raise-fold: rgba(139, 74, 156, 0.12);   /* +EV fold — subordinate */
  --raise-fold-line: rgba(139, 74, 156, 0.30);

  font-family: var(--font);
  background: var(--bg-body);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.pd-pushbot .app {
  max-width: 1160px;
  margin: 0 auto;
  padding: 16px 16px 60px;
}

/* Header */
.pd-pushbot .hdr {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 10px 0;
}
.pd-pushbot .hdr-logo {
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.pd-pushbot .hdr-logo::after {
  content: '';
  width: 5px;
  height: 5px;
  background: var(--green);
  border-radius: 50%;
}
.pd-pushbot .hdr h1 { font-size: 22px; font-weight: 800; }
.pd-pushbot .hdr h1 span { color: var(--green); }

/* Layout */
.pd-pushbot .layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 14px;
  align-items: start;
}

/* Panel */
.pd-pushbot .panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  position: sticky;
  top: 12px;
}
.pd-pushbot .section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--text-muted);
  margin: 14px 0 6px;
}
.pd-pushbot .section-label:first-child { margin-top: 0; }

/* Stepper */
.pd-pushbot .stepper-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.pd-pushbot .stepper {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.pd-pushbot .stepper button {
  width: 30px;
  height: 30px;
  border: none;
  background: var(--bg-input);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
}
.pd-pushbot .stepper button:hover { background: var(--bg-hover); }
.pd-pushbot .stepper button:disabled { opacity: 0.3; cursor: not-allowed; }
.pd-pushbot .stepper .val {
  width: 30px;
  text-align: center;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  background: var(--bg-panel);
  color: var(--text);
}
.pd-pushbot .stepper-label { font-size: 12px; color: var(--text-dim); }

/* Blinds */
.pd-pushbot .blinds-row { display: flex; gap: 6px; margin-bottom: 6px; }
.pd-pushbot .blind-group { flex: 1; }
.pd-pushbot .blind-group label {
  display: block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.pd-pushbot .blind-group input,
.pd-pushbot .stack-input,
.pd-pushbot .raise-size-input,
.pd-pushbot .payout-input {
  width: 100%;
  padding: 5px 7px;
  font-family: var(--mono);
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  background: var(--bg-input);
  color: var(--text);
}
.pd-pushbot .blind-group input:focus,
.pd-pushbot .stack-input:focus,
.pd-pushbot .raise-size-input:focus,
.pd-pushbot .payout-input:focus {
  border-color: var(--green);
}

/* Stack table */
.pd-pushbot .stack-header {
  display: grid;
  grid-template-columns: 44px 54px 42px 1fr;
  gap: 6px;
  padding: 0 0 4px 0;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--border);
}
.pd-pushbot .stack-header span {
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.pd-pushbot .stack-header .col-stack { text-align: center; }
.pd-pushbot .stack-header .col-rfi { text-align: center; }

.pd-pushbot .stack-row {
  display: grid;
  grid-template-columns: 44px 54px 42px 1fr;
  gap: 6px;
  align-items: center;
  margin-bottom: 1px;
  min-height: 26px;
}
.pd-pushbot .stack-pos {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  text-align: right;
  cursor: pointer;
  color: var(--text-muted);
  user-select: none;
  transition: color 0.1s;
  padding-right: 2px;
  white-space: nowrap;
}
.pd-pushbot .stack-pos:hover { color: var(--text-dim); }
.pd-pushbot .stack-pos.hero { color: var(--green); font-weight: 700; }
.pd-pushbot .stack-input {
  width: 100%;
  padding: 4px 5px;
  font-size: 11px;
  text-align: right;
}
.pd-pushbot .rfi-input {
  width: 100%;
  padding: 4px 5px;
  font-size: 11px;
  font-family: var(--mono);
  text-align: right;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--amber);
}
.pd-pushbot .rfi-input:disabled { opacity: 0.35; }

/* Position action dropdown */
.pd-pushbot .pos-action-wrap { position: relative; }
.pd-pushbot .pos-action-btn {
  padding: 3px 7px;
  font-size: 9px;
  font-weight: 700;
  font-family: var(--mono);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.1s;
  line-height: 1.2;
  min-width: 42px;
  text-align: center;
}
.pd-pushbot .pos-action-btn:hover { background: var(--bg-hover); }
.pd-pushbot .pos-action-btn.act-fold { color: var(--text-muted); }
.pd-pushbot .pos-action-btn.act-shove { color: var(--green); border-color: var(--green-dark); background: var(--bg-active); }
.pd-pushbot .pos-action-btn.act-raise { color: var(--amber); border-color: var(--raise-line); background: var(--raise-1); }
.pd-pushbot .pos-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 2px;
  background: var(--bg-panel);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-lg);
  padding: 3px;
  z-index: 100;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 60px;
}
.pd-pushbot .pos-dropdown-item {
  padding: 5px 10px;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-dim);
  text-align: left;
  transition: background 0.08s;
  white-space: nowrap;
}
.pd-pushbot .pos-dropdown-item:hover { background: var(--bg-hover); color: var(--text); }
.pd-pushbot .pos-dropdown-item.selected { color: var(--green); }

/* Action rows */
.pd-pushbot .action-row {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 3px;
}
.pd-pushbot .action-pos {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  width: 42px;
  text-align: right;
  color: var(--text-muted);
  flex-shrink: 0;
}
.pd-pushbot .action-pills {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
}
.pd-pushbot .action-pill {
  padding: 3px 8px;
  font-family: var(--font);
  font-size: 9px;
  font-weight: 700;
  border: none;
  background: var(--bg-input);
  cursor: pointer;
  color: var(--text-muted);
  border-right: 1px solid var(--border);
  transition: all 0.1s;
}
.pd-pushbot .action-pill:last-child { border-right: none; }
.pd-pushbot .action-pill:hover { background: var(--bg-hover); }
.pd-pushbot .action-pill.active { background: var(--bg-hover); color: var(--text); }
.pd-pushbot .action-pill.active.fold-pill { color: var(--red); }
.pd-pushbot .action-pill.active.raise-pill { color: var(--amber); }
.pd-pushbot .action-pill.active.push-pill { color: var(--green); }
.pd-pushbot .raise-size-input {
  width: 44px;
  padding: 3px 5px;
  font-size: 10px;
  text-align: center;
  color: var(--amber);
  border-color: var(--border);
}
.pd-pushbot .raise-size-input:focus { border-color: var(--amber); }
.pd-pushbot .raise-unit { font-size: 8px; color: var(--text-muted); }

/* Hero open */
.pd-pushbot .hero-open {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: var(--bg-active);
  border: 1px solid var(--green-dark);
  border-radius: var(--radius-md);
  margin: 6px 0;
}
.pd-pushbot .hero-open label { font-size: 10px; font-weight: 700; color: var(--green); }
.pd-pushbot .hero-open input {
  width: 44px;
  padding: 3px 5px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--green-dark);
  border-radius: var(--radius-sm);
  outline: none;
  text-align: center;
  color: var(--green);
  background: var(--bg-panel);
}
.pd-pushbot .hero-open .unit { font-size: 9px; color: var(--green); }

/* Calculate button */
.pd-pushbot .calc-btn {
  width: 100%;
  padding: 10px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  /* Burgundy, not --green. tokens.css assigns --color-bg-dark to "primary
     button fill" and --color-positive to "semantic green" for data values.
     Green also MEANS push inside this tool, so a green button that is not a
     push cell weakens the encoding the matrix depends on. */
  background: var(--color-bg-dark);
  color: var(--color-text-on-dark);
  border: none;
  border-radius: 0;
  cursor: pointer;
  margin-top: 10px;
  transition: background 0.12s;
}
.pd-pushbot .calc-btn:hover { background: var(--color-accent-hover); }

/* Results panel */
.pd-pushbot .results {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.pd-pushbot .result-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg-input);
  overflow-x: auto;
}
.pd-pushbot .result-tab {
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  transition: all 0.1s;
  white-space: nowrap;
}
.pd-pushbot .result-tab.active {
  color: var(--text);
  background: var(--bg-panel);
  border-bottom-color: var(--green);
}
.pd-pushbot .result-tab:hover { color: var(--text-dim); }

.pd-pushbot .result-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.pd-pushbot .rh-stat { display: flex; flex-direction: column; }
.pd-pushbot .rh-value {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
}
.pd-pushbot .rh-value.positive { color: var(--green); }
.pd-pushbot .rh-label {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}
.pd-pushbot .rh-divider { width: 1px; height: 32px; background: var(--border); }
.pd-pushbot .rh-badge {
  margin-left: auto;
  padding: 3px 10px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  letter-spacing: 1px;
}
.pd-pushbot .rh-badge.cev { background: var(--bg-active); color: var(--green); border: 1px solid var(--green-dark); }
.pd-pushbot .rh-badge.adjusted { background: var(--color-accent-subtle); color: var(--purple); border: 1px solid var(--color-accent-border); }

/* Legend */
.pd-pushbot .legend {
  display: flex;
  gap: 12px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.pd-pushbot .legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
}
.pd-pushbot .legend-dot { width: 10px; height: 10px; border-radius: var(--radius-sm); }

/* Matrix */
.pd-pushbot .matrix-wrap { padding: 10px 12px 8px; }
.pd-pushbot .matrix {
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  gap: 1px;
  font-family: var(--mono);
}
.pd-pushbot .cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  line-height: 1.1;
  padding: 2px 0;
  min-height: 38px;
  color: var(--text);
  background: var(--bg-input);
  border: 1px solid var(--border);
  position: relative;
  cursor: pointer;
  transition: all 0.08s;
  user-select: none;
}
.pd-pushbot .cell:hover { border-color: var(--border-hover); z-index: 2; transform: scale(1.08); }
.pd-pushbot .cell .hand { font-size: 9px; font-weight: 700; }
.pd-pushbot .cell .ev { font-size: 7px; font-weight: 500; color: var(--text-muted); margin-top: 1px; }

/* Cell action colors — this is the encoding. Hue = action, fill intensity = strength. */
.pd-pushbot .cell.push-cell { background: var(--push-1); border-color: var(--push-line); }
.pd-pushbot .cell.push-cell .ev { color: var(--green-ink); }
.pd-pushbot .cell.push-cell.strong { background: var(--push-2); }
.pd-pushbot .cell.push-cell.very-strong { background: var(--push-3); border-color: var(--push-line-strong); }
.pd-pushbot .cell.raise-cell { background: var(--raise-1); border-color: var(--raise-line); }
.pd-pushbot .cell.raise-cell .ev { color: var(--raise-ink); }
.pd-pushbot .cell.raise-cell.strong { background: var(--raise-2); }
.pd-pushbot .cell.raise-cell.very-strong { background: var(--raise-3); border-color: var(--raise-line-strong); }

.pd-pushbot .cell.fold-cell .ev { color: var(--red); }

/* Profitable fold: hand has +EV but Nash says fold (mixed strategy zone) */
.pd-pushbot .cell.profitable-fold { background: var(--raise-fold); border-color: var(--raise-fold-line); }
.pd-pushbot .cell.profitable-fold .ev { color: var(--amber); }
.pd-pushbot .cell.profitable-fold .hand { color: var(--amber); }

/* Toggled off by user */
.pd-pushbot .cell.user-off {
  background: var(--bg-input) !important;
  border-color: var(--border) !important;
  opacity: 0.5;
}
.pd-pushbot .cell.user-on {
  outline: 2px solid var(--purple);
  outline-offset: -1px;
}

/* Tooltip */
.pd-pushbot .cell .tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-panel);
  color: var(--text);
  padding: 6px 10px;
  border-radius: var(--radius-md);
  font-size: 10px;
  white-space: nowrap;
  z-index: 100;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}
.pd-pushbot .cell:hover .tooltip { display: block; }

/* Threshold */
.pd-pushbot .threshold-row {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.pd-pushbot .threshold-row label { font-size: 10px; font-weight: 600; color: var(--text-dim); }
.pd-pushbot .advanced-section { padding: 0 16px 8px; }
.pd-pushbot .advanced-toggle {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 0;
  list-style: none;
}
.pd-pushbot .advanced-toggle::-webkit-details-marker { display: none; }
.pd-pushbot .advanced-toggle::before { content: '▸ '; }
.pd-pushbot details[open] .advanced-toggle::before { content: '▾ '; }
.pd-pushbot .threshold-input {
  width: 60px;
  padding: 4px 6px;
  font-family: var(--mono);
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  text-align: center;
  background: var(--bg-input);
  color: var(--text);
}
.pd-pushbot .threshold-input:focus { border-color: var(--green); }
.pd-pushbot .range-pct {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--green);
  margin-left: auto;
}

/* Output row */
.pd-pushbot .output-row {
  padding: 8px 16px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: start;
}
.pd-pushbot .range-text {
  flex: 1;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  line-height: 1.5;
  word-break: break-all;
  max-height: 48px;
  overflow-y: auto;
  padding: 6px 8px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.pd-pushbot .copy-btn {
  padding: 6px 12px;
  font-size: 10px;
  font-weight: 700;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 0;
  cursor: pointer;
  color: var(--text-dim);
  white-space: nowrap;
}
.pd-pushbot .copy-btn:hover { background: var(--bg-hover); }

/* Edit mode indicator */
.pd-pushbot .edit-bar {
  padding: 6px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--color-accent-subtle);
}
.pd-pushbot .edit-bar.hidden { display: none; }
.pd-pushbot .edit-label { font-size: 10px; font-weight: 600; color: var(--purple); }
.pd-pushbot .edit-btn {
  padding: 3px 10px;
  font-size: 9px;
  font-weight: 700;
  border: 1px solid var(--border);
  border-radius: 0;
  cursor: pointer;
  background: var(--bg-input);
  color: var(--text-dim);
}
.pd-pushbot .edit-btn:hover { background: var(--bg-hover); }
.pd-pushbot .clear-all-btn {
  padding: 3px 8px;
  font-size: 9px;
  font-weight: 700;
  font-family: var(--font);
  border: 1px solid var(--color-accent-border);
  border-radius: 0;
  cursor: pointer;
  background: var(--color-accent-subtle);
  color: var(--purple);
  margin-left: auto;
  white-space: nowrap;
  transition: all 0.1s;
}
.pd-pushbot .clear-all-btn:hover { background: var(--bg-hover); border-color: var(--purple); }
.pd-pushbot .clear-all-btn.hidden { display: none; }
.pd-pushbot .edit-spacer { flex: 1; }

/* CTA */
.pd-pushbot .cta {
  text-align: center;
  padding: 24px 16px;
  margin-top: 16px;
}
.pd-pushbot .cta p { font-size: 13px; color: var(--text-dim); margin-bottom: 12px; }
.pd-pushbot .cta strong { color: var(--text); }
.pd-pushbot .cta-link {
  display: inline-block;
  padding: 10px 24px;
  font-weight: 700;
  font-size: 13px;
  background: var(--color-accent);
  color: var(--color-text-on-dark);
  border-radius: 0;
  text-decoration: none;
}
.pd-pushbot .cta-link:hover { background: var(--color-accent-hover); }
.pd-pushbot .tool-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.pd-pushbot .tool-links a { font-size: 11px; color: var(--text-muted); text-decoration: none; }
.pd-pushbot .tool-links a:hover { color: var(--color-accent); }
.pd-pushbot .footer {
  text-align: center;
  padding: 16px;
  font-size: 10px;
  color: var(--text-muted);
}
.pd-pushbot .footer a { color: var(--text-muted); text-decoration: none; }

/* Responsive */
@media (max-width: 740px) {
  .pd-pushbot .layout { grid-template-columns: 1fr; }
  .pd-pushbot .panel { position: static; }
  .pd-pushbot .cell { min-height: 24px; }
  .pd-pushbot .cell .hand { font-size: 8px; }
  .pd-pushbot .cell .ev { font-size: 7px; }
  .pd-pushbot .hdr h1 { font-size: 18px; }
  .pd-pushbot .matrix { gap: 1px; }
}
