/* Page Outils : équité (cartes ou ranges), cotes du pot, outs, compteur de BB et variance.
   Les couleurs viennent des jetons du thème (theme.css) : noir chaud, bordeaux, rouge de la marque. */
#toolsView { --sw:54px; --sh:76px; --gap:8px; max-width:1040px; }
#pokerTools { display:grid; gap:20px; }
#pokerTools label { display:flex; flex-direction:column; gap:7px; font-size:12px; line-height:1.3; min-width:0; color:var(--muted); }
#pokerTools input,#pokerTools select { height:46px; min-height:46px; box-sizing:border-box; margin:0; font-size:15px; }
#pokerTools .pt-card { overflow:visible; position:relative; }
#pokerTools .pt-body { padding:0 22px 22px; }
#pokerTools .panel-head { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; padding:20px 22px 14px; }
#pokerTools .panel-head h2 { margin:0; font-size:19px; }
#pokerTools svg { stroke:currentColor; fill:none; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }

/* Onglets et commutateurs */
.pt-tabs { gap:3px; padding:4px; height:50px; box-sizing:border-box; max-width:520px; width:100%; border-radius:14px; box-shadow:inset 0 1px 2px #0008; }
.pt-tabs button,.pt-mode button { flex:1; min-width:0; min-height:40px; padding:0 14px; border:0; border-radius:10px; background:none; color:var(--muted); font-size:13px; font-weight:600; white-space:nowrap; }
.pt-tabs button[aria-pressed="true"],.pt-mode button[aria-pressed="true"] { background:linear-gradient(180deg,#4a1d26,#33141b); color:#fff; box-shadow:0 1px 0 #ffffff14 inset,0 6px 14px -8px #000; }
.pt-mode { gap:3px; padding:3px; height:44px; box-sizing:border-box; width:auto; min-width:190px; border-radius:12px; }
.pt-switch { display:inline-flex; padding:3px; gap:2px; border-radius:10px; background:var(--panel-2); border:1px solid var(--border); }
.pt-switch button { min-height:34px; padding:0 12px; border:0; border-radius:7px; background:none; color:var(--muted); font-size:12px; font-weight:600; }
.pt-switch button[aria-pressed="true"] { background:var(--seg-on); color:#fff; }
.pt-icon { display:inline-grid; place-items:center; width:40px; height:40px; padding:0; border:1px solid var(--border); border-radius:12px; background:linear-gradient(180deg,#1f1013,#170c0f); color:#e8cfd3; box-shadow:0 1px 0 #ffffff0d inset; }
.pt-icon svg { width:19px; height:19px; }
.pt-icon[aria-pressed="true"] { background:var(--seg-on); color:#fff; }
@media(hover:hover){ .pt-icon:hover { color:#fff; border-color:#5c2832; } }
.pt-head-tools { display:flex; gap:8px; }

/* Joueurs */
.pt-player { position:relative; padding:14px 0 16px; border-top:1px solid var(--border); }
.pt-player:first-child { border-top:0; padding-top:2px; }
.pt-player-top { display:flex; align-items:center; gap:10px; flex-wrap:wrap; min-height:40px; }
.pt-player-top strong { font:600 15px var(--font-display); }
.pt-player-tools { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-left:auto; }
.pt-player-body { display:flex; align-items:center; gap:18px; margin-top:8px; }
.pt-hand { display:flex; align-items:center; gap:12px; min-width:0; flex-wrap:wrap; }
.pt-slots { display:flex; gap:var(--gap); flex:none; }
.pt-hint { color:var(--muted); font-size:12px; }
.pt-eq { margin-left:auto; text-align:right; min-width:0; }
.pt-eq b { display:block; font:600 30px/1.05 var(--font-display); font-variant-numeric:tabular-nums; letter-spacing:-.02em; }
.pt-eq small { display:block; margin-top:4px; font-size:12px; line-height:1.4; color:var(--muted); font-variant-numeric:tabular-nums; white-space:nowrap; }
.pt-bar { height:6px; margin-top:14px; background:#00000059; border-radius:4px; overflow:hidden; box-shadow:inset 0 1px 2px #000a; }
.pt-bar span { display:block; width:0; height:100%; border-radius:4px; background:linear-gradient(90deg,#7a2e3a,#b9404c); transition:width .3s cubic-bezier(.2,.8,.2,1); }
.pt-player.lead .pt-bar span { background:linear-gradient(90deg,#3e9e70,var(--positive)); }
.pt-player.lead .pt-eq b { color:var(--positive); }
.pt-add { display:inline-flex; align-items:center; gap:8px; min-height:44px; margin-top:6px; padding:0 14px; border:1px dashed #5c2832; border-radius:12px; background:none; color:#e8cfd3; font-size:13px; font-weight:600; }
.pt-add svg { width:18px; height:18px; }
@media(hover:hover){ .pt-add:hover { border-style:solid; color:#fff; } }

/* Emplacements et cartes : des cartes en volume, pas des rectangles plats */
.pt-slot { position:relative; display:flex; align-items:center; justify-content:center; width:var(--sw); height:var(--sh); padding:0; border:1.5px dashed #5c2832; border-radius:9px; background:radial-gradient(120% 90% at 50% 0%,#24101466,#0f0709); color:#b98d95; transition:transform .12s ease-out; }
.pt-slot.filled { border:0; background:none; }
.pt-slot.active { outline:2px solid var(--accent); outline-offset:3px; }
.pt-plus svg { width:22px; height:22px; }
.pt-face { display:flex; flex-direction:column; align-items:center; justify-content:center; width:100%; height:100%; border-radius:8px; background:linear-gradient(150deg,#fff 0%,#f1ecee 60%,#e2dadd 100%); color:#1d212a; box-shadow:0 1px 0 #fff inset,0 10px 18px -8px #000,0 2px 4px #0006; font-weight:750; line-height:1.05; }
.pt-face.red,.pt-deck-card.red { color:#bd273d; }
.pt-face b { font-size:calc(var(--sw)*.4); }
.pt-face i { font-style:normal; font-size:calc(var(--sw)*.42); }
.pt-slot:active { transform:scale(.96); }
.pt-board { margin-top:16px; padding:16px; border-radius:16px; background:radial-gradient(130% 120% at 50% 0%,#3a1018 0%,#1c0b0f 70%); border:1px solid #4f2029; box-shadow:inset 0 1px 0 #ffffff10,inset 0 -12px 24px #0006; }
.pt-board-head { display:flex; align-items:center; gap:10px; flex-wrap:wrap; min-height:40px; margin-bottom:10px; }
.pt-board-head strong { font:600 15px var(--font-display); }
.pt-board-slots { display:flex; align-items:center; gap:var(--gap); }
.pt-flop { display:flex; gap:var(--gap); margin-right:14px; }
.pt-status { margin:14px 0 0; font-size:12px; color:var(--muted); min-height:18px; font-variant-numeric:tabular-nums; }
.pt-status.warn { color:#f0c27a; }

/* Historique des derniers calculs */
.pt-history { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin-top:12px; }
.pt-history:empty { display:none; }
.pt-history-title { width:100%; font-size:12px; color:var(--muted); }
.pt-chip { display:inline-flex; align-items:center; gap:8px; min-height:36px; max-width:100%; padding:0 12px; border:1px solid var(--border); border-radius:999px; background:linear-gradient(180deg,#1f1013,#160b0e); color:#ead7da; font-size:12px; box-shadow:0 1px 0 #ffffff0d inset; }
.pt-chip span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.pt-chip b { color:#fff; font-variant-numeric:tabular-nums; }
@media(hover:hover){ .pt-chip:hover { border-color:#5c2832; color:#fff; } }

/* Panneau de cartes : il glisse depuis le bas quand on touche un emplacement */
.pt-sheet { position:fixed; left:50%; bottom:0; z-index:60; width:min(760px,100%); transform:translateX(-50%); padding:14px 16px calc(16px + env(safe-area-inset-bottom)); border:1px solid #4f2029; border-bottom:0; border-radius:20px 20px 0 0; background:linear-gradient(180deg,#22101499,#140a0c) ,#140a0c; box-shadow:0 -18px 40px -10px #000c; animation:pt-sheet-in .22s cubic-bezier(.2,.8,.2,1); }
@keyframes pt-sheet-in { from { transform:translate(-50%,24px); opacity:0; } to { transform:translateX(-50%); opacity:1; } }
.pt-sheet-head { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:10px; }
.pt-sheet-head strong { font:600 15px var(--font-display); }
.pt-deck { display:grid; gap:6px; }
.pt-suit { display:grid; grid-template-columns:repeat(13,minmax(0,1fr)); gap:5px; }
.pt-deck-card { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:1px; min-width:0; min-height:52px; padding:5px 0; border:0; border-radius:7px; background:linear-gradient(150deg,#fff,#ebe5e7); color:#1d212a; font-size:15px; font-weight:750; line-height:1.05; box-shadow:0 1px 0 #fff inset,0 4px 8px -3px #000a; transition:transform .1s ease-out; }
.pt-deck-card i { font-style:normal; font-size:18px; }
.pt-deck-card.picked { outline:2px solid var(--accent); outline-offset:1px; }
.pt-deck-card[aria-disabled="true"] { background:#2a171b; color:#6f5157; box-shadow:none; cursor:not-allowed; }
.pt-deck-card:active:not([aria-disabled="true"]) { transform:scale(.94); }
@media(hover:hover){ .pt-deck-card:not([aria-disabled="true"]):hover { transform:translateY(-2px); } }

/* Ranges : grille 13 × 13 */
.pt-range-chip { min-height:44px; padding:0 16px; border:1px solid #6a2a35; border-radius:12px; background:linear-gradient(180deg,#3a1720,#26101a); color:#fff; font:600 14px var(--font-display); box-shadow:0 1px 0 #ffffff12 inset,0 8px 16px -10px #000; }
.pt-range-chip { display:inline-flex; align-items:center; gap:10px; cursor:pointer; transition:border-color .15s, transform .1s ease-out; }
.pt-range-chip .pt-chev { width:18px; height:18px; flex:none; padding:3px; box-sizing:content-box; border-radius:50%; background:#ffffff14; fill:none; stroke:currentColor; stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round; transition:transform .25s cubic-bezier(.2,.8,.2,1); }
.pt-range-chip.open { border-color:var(--accent); }
.pt-range-chip.open .pt-chev { transform:rotate(180deg); background:var(--accent-solid); }
.pt-range-chip:active { transform:scale(.97); }
@media(prefers-reduced-motion:reduce){ .pt-range-chip .pt-chev { transition:none; } }
.pt-range { margin-top:14px; padding:14px; border:1px solid var(--border); border-radius:16px; background:var(--panel-2); box-shadow:inset 0 2px 6px #0007; }
.pt-range-head { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:10px 16px; margin-bottom:12px; }
.pt-slider { flex:1 1 220px; display:grid !important; gap:6px !important; }
.pt-slider span { font-size:12px; }
.pt-slider b { color:#fff; font-size:14px; }
#pokerTools .pt-slider input { height:28px; min-height:28px; padding:0; accent-color:var(--accent); background:none; border:0; }
.pt-range-presets { display:flex; gap:6px; flex-wrap:wrap; }
.pt-grid { display:grid; grid-template-columns:repeat(13,minmax(0,1fr)); gap:2px; touch-action:none; user-select:none; -webkit-user-select:none; }
.pt-cell { aspect-ratio:1; min-width:0; padding:0; border:0; border-radius:4px; font-size:12px; font-weight:600; line-height:1; color:#a3858b; background:#1a0e11; }
.pt-cell.pair { background:#241216; }
.pt-cell.suited { background:#1d1013; }
.pt-cell.on { color:#fff; background:linear-gradient(180deg,#d4404d,#a52a37); box-shadow:0 1px 0 #ffffff26 inset; }
.pt-cell.pair.on { background:linear-gradient(180deg,#e8606b,#bf3743); }
.pt-cell.offsuit.on { background:linear-gradient(180deg,#9c3642,#7a2531); }
.pt-range-foot { display:flex; flex-wrap:wrap; justify-content:space-between; gap:8px; margin:10px 0 0; font-size:12px; color:var(--muted); }
.pt-legend { display:inline-flex; align-items:center; gap:6px; }
.pt-legend i { display:inline-block; width:10px; height:10px; border-radius:3px; margin-left:6px; }
.pt-legend i.pair { background:#e8606b; } .pt-legend i.suited { background:#d4404d; } .pt-legend i.offsuit { background:#9c3642; }

/* Cotes du pot et outs : repliés, ils s’ouvrent au clic */
.pt-two { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; align-items:start; }
.pt-fold { padding:0; }
.pt-fold>summary { list-style:none; display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:64px; padding:16px 20px; cursor:pointer; }
.pt-fold>summary::-webkit-details-marker { display:none; }
.pt-fold>summary span { display:grid; gap:3px; min-width:0; }
.pt-fold>summary b { font:600 17px var(--font-display); }
.pt-fold>summary small { color:var(--muted); font-size:12px; }
.pt-fold>summary::after { content:""; flex:none; width:9px; height:9px; border-right:2px solid var(--muted); border-bottom:2px solid var(--muted); transform:rotate(45deg); transition:transform .2s ease; margin:-4px 4px 0 0; }
.pt-fold[open]>summary::after { transform:rotate(-135deg); margin-top:4px; }
.pt-fold>summary:focus-visible { outline:2px solid var(--accent); outline-offset:-2px; border-radius:inherit; }
.pt-fold .pt-body { padding-top:4px; }
.pt-form-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:14px; align-items:end; }
.pt-form-grid.pt-two-fields { grid-template-columns:repeat(2,minmax(0,1fr)); }
.pt-form-grid.pt-three { grid-template-columns:repeat(3,minmax(0,1fr)); }
.pt-form-grid.pt-four { grid-template-columns:repeat(4,minmax(0,1fr)); }
.pt-facts { margin:16px 0 0; padding:0; }
.pt-facts>div { display:flex; justify-content:space-between; align-items:baseline; gap:16px; padding:10px 0; border-top:1px solid var(--border); }
.pt-facts dt { color:var(--muted); font-size:12px; }
.pt-facts dd { margin:0; text-align:right; font:600 16px var(--font-display); font-variant-numeric:tabular-nums; }
.pt-verdict { margin:14px 0 0; padding:12px 14px; border:1px solid; border-radius:12px; font-size:13px; font-weight:650; line-height:1.5; }
.pt-verdict.good { color:var(--positive); background:#0f241b; border-color:#1f5a42; }
.pt-verdict.bad { color:var(--red); background:#2c1416; border-color:#6a2c35; }
.pt-note { margin:14px 0 0; color:var(--muted); font-size:12px; line-height:1.6; }

/* Compteur de BB */
.pt-bb-big { display:flex; flex-wrap:wrap; align-items:baseline; gap:6px 10px; margin-top:22px; }
.pt-bb-big b { font:600 58px/1 var(--font-display); letter-spacing:-.03em; font-variant-numeric:tabular-nums; }
.pt-bb-big span { font-size:18px; color:var(--muted); font-weight:600; }
.pt-bb-big em { flex-basis:100%; font-style:normal; font-size:13px; color:#ead7da; }
.pt-gauge { margin-top:16px; }
.pt-gauge-track { height:12px; background:#0008; border-radius:6px; overflow:hidden; box-shadow:inset 0 1px 3px #000c; }
.pt-gauge-track span { display:block; height:100%; border-radius:6px; background:currentColor; transition:width .3s cubic-bezier(.2,.8,.2,1); }
.pt-gauge-scale { position:relative; height:18px; margin-top:6px; font-size:12px; color:var(--muted); font-variant-numeric:tabular-nums; }
.pt-gauge-scale span { position:absolute; top:0; transform:translateX(-50%); }
.pt-gauge-scale span:last-child { transform:translateX(-100%); }
.pt-bb-big.good b,.pt-gauge.good,.pt-stat.good b { color:#7be3a8; }
.pt-bb-big.ok b,.pt-gauge.ok,.pt-stat.ok b { color:#f0c27a; }
.pt-bb-big.warn b,.pt-gauge.warn,.pt-stat.warn b { color:#f5935b; }
.pt-bb-big.bad b,.pt-gauge.bad,.pt-stat.bad b { color:#ff6b74; }

/* Variance */
.pt-var-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; margin-top:18px; }
.pt-stat { display:grid; align-content:start; gap:4px; padding:14px 16px; border:1px solid var(--border); border-radius:14px; background:linear-gradient(180deg,#1d0f12,#150a0d); box-shadow:0 1px 0 #ffffff0d inset,0 10px 20px -16px #000; min-width:0; }
.pt-stat span { font-size:12px; color:var(--muted); }
.pt-stat b { font:600 26px/1.1 var(--font-display); font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
.pt-stat small { font-size:12px; color:var(--muted); line-height:1.4; }
.pt-var-chart { margin:18px 0 0; }
.pt-var-chart svg { display:block; width:100%; height:auto; stroke-width:1 !important; }
.pt-var-chart text { fill:var(--muted); stroke:none; font:12px var(--font-body); }
.pt-var-chart .band95 { fill:#b9404c33; stroke:none; }
.pt-var-chart .band68 { fill:#b9404c55; stroke:none; }
.pt-var-chart .mean { fill:none; stroke:#fff; stroke-width:2.2; }
.pt-var-chart .grid { stroke:#44222b; stroke-dasharray:3 5; }
.pt-var-chart .zero { stroke:#7a3a45; }
.pt-var-chart figcaption { display:flex; flex-wrap:wrap; align-items:center; gap:6px 14px; margin-top:8px; font-size:12px; color:var(--muted); }
.pt-var-chart figcaption i { display:inline-block; width:14px; height:8px; border-radius:2px; margin-right:-8px; }
.pt-var-chart figcaption i.band95 { background:#b9404c55; } .pt-var-chart figcaption i.band68 { background:#b9404c99; } .pt-var-chart figcaption i.mean { background:#fff; height:2px; }

/* Mode table : seule la carte d’équité reste à l’écran, en grand */
html.pt-table-open .sidebar,html.pt-table-open main>header,html.pt-table-open #demoBanner,html.pt-table-open .pt-tabs,html.pt-table-open #ptEquity>.pt-two { display:none !important; }
html.pt-table-open main { margin:0 !important; padding:0 !important; width:100% !important; max-width:none !important; }
html.pt-table-open #toolsView { max-width:none; }
html.pt-table-open #pokerTools { gap:0; }
#pokerTools .pt-table-mode { min-height:100dvh; border:0; border-radius:0; padding-top:env(safe-area-inset-top); background:radial-gradient(120% 80% at 50% 0%,#4a1320 0%,#1f0d12 55%,#0b0708 100%); --sw:72px; --sh:100px; --gap:10px; }
.pt-table-mode .panel-head { padding:18px 20px 10px; }
.pt-table-mode .pt-eq b { font-size:46px; }
.pt-table-mode .pt-player-top strong,.pt-table-mode .pt-board-head strong { font-size:18px; }
.pt-table-mode .pt-board { margin-top:20px; }
.pt-table-mode .pt-deck-card { min-height:64px; font-size:18px; }
.pt-table-mode .pt-history { display:none; }

@media(max-width:900px) { .pt-two { grid-template-columns:1fr; } .pt-var-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media(max-width:700px) {
  #toolsView { --sw:48px; --sh:68px; --gap:7px; }
  #pokerTools { gap:16px; }
  #pokerTools .pt-body { padding:0 16px 18px; }
  #pokerTools .panel-head { padding:16px 16px 12px; }
  .pt-tabs { max-width:none; }
  .pt-tabs button { padding:0 6px; font-size:12.5px; }
  .pt-stat b { font-size:22px; }
  .pt-mode { width:100%; }
  .pt-player-body { gap:10px; }
  .pt-eq b { font-size:24px; }
  .pt-board { padding:12px; }
  .pt-flop { margin-right:10px; }
  .pt-sheet { padding:12px 10px calc(12px + env(safe-area-inset-bottom)); border-radius:18px 18px 0 0; }
  .pt-suit { grid-template-columns:repeat(13,minmax(0,1fr)); gap:3px; }
  .pt-deck-card { min-height:46px; font-size:13px; border-radius:6px; }
  .pt-deck-card i { font-size:14px; }
  .pt-cell { font-size:12px; border-radius:3px; }
  .pt-form-grid.pt-three,.pt-form-grid.pt-four { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .pt-form-grid.pt-three>label:last-child { grid-column:1/-1; }
  .pt-bb-big b { font-size:48px; }
  .pt-facts>div { flex-direction:column; align-items:flex-start; gap:3px; }
  .pt-facts dd { text-align:left; }
  #pokerTools .pt-table-mode { --sw:52px; --sh:74px; --gap:7px; }
  .pt-table-mode .pt-eq b { font-size:34px; }
  .pt-table-mode .pt-deck-card { min-height:50px; font-size:14px; }
}
@media(pointer:coarse) { .pt-icon,.pt-switch button { min-height:44px; } .pt-icon { width:44px; height:44px; } }
@media(prefers-reduced-motion:reduce) { .pt-bar span,.pt-gauge-track span { transition:none; } .pt-sheet { animation:none; } .pt-deck-card,.pt-slot { transition:none; } }
@media(prefers-contrast:more) { .pt-slot { border-color:#c99aa2; } .pt-deck-card[aria-disabled="true"] { opacity:.75; } }

/* Panneau de cartes amovible (21/11) : poignée, réduire, détacher ; fenêtre flottante sur ordinateur */
.pt-sheet-head { position:relative; cursor:grab; touch-action:none; user-select:none; -webkit-user-select:none; border-radius:12px; outline:none; padding-top:8px; }
.pt-sheet-head:focus-visible { box-shadow:0 0 0 2px #e74953; }
.pt-sheet-grip { position:absolute; left:50%; top:-6px; width:40px; height:4px; margin-left:-20px; border-radius:99px; background:#ffffff33; }
.pt-sheet-head strong { flex:1; min-width:0; }
.pt-sheet-tools { display:flex; align-items:center; gap:6px; }
.pt-sheet-fold .pt-chev { transition:transform .25s cubic-bezier(.2,.8,.2,1); transform:rotate(0deg); }
.pt-sheet.is-collapsed .pt-sheet-fold .pt-chev { transform:rotate(180deg); }
.pt-sheet.is-collapsed .pt-deck { display:none; }
.pt-sheet.is-collapsed .pt-sheet-head { margin-bottom:0; }
.pt-sheet.is-dragging { cursor:grabbing; box-shadow:0 34px 70px -20px #000; }
.pt-sheet.is-dragging .pt-sheet-head { cursor:grabbing; }
.pt-sheet--float { left:24px; top:96px; bottom:auto; width:min(560px, calc(100vw - 32px)); transform:none; padding:12px 14px 14px; border:1px solid #5a2630; border-radius:18px; background:linear-gradient(180deg,#2a1218f2,#170b0ef2); -webkit-backdrop-filter:blur(14px) saturate(140%); backdrop-filter:blur(14px) saturate(140%); box-shadow:0 28px 60px -22px #000, inset 0 1px 0 #ffffff12; animation:pt-float-in .2s cubic-bezier(.2,.8,.2,1); }
.pt-sheet--float .pt-sheet-grip { display:none; }
.pt-sheet--float .pt-deck-card { min-height:42px; font-size:13px; }
.pt-sheet--float .pt-deck-card i { font-size:15px; }
@keyframes pt-float-in { from { opacity:.6; scale:.98; } to { opacity:1; scale:1; } }
@media (max-width: 759px) { .pt-sheet-float { display:none; } .pt-sheet.is-dragging { transition:none; } .pt-sheet { transition:translate .25s cubic-bezier(.2,.8,.2,1); } }
@media (prefers-reduced-motion: reduce) { .pt-sheet--float { animation:none; } .pt-sheet-fold .pt-chev { transition:none; } }
