/* Poker Spot hand-replay simulator — reusable styles.
 *
 * These are the exact styles from the /hand/ share-page replay, lifted verbatim
 * and scoped under `.psim` so the simulator can be dropped onto any page (and
 * more than once per page) without colliding with the host page's own classes.
 * Paired with replay-ui.js, which builds the markup and drives it off the shared
 * PokerReplay engine. Values reference the site's design tokens from styles.css;
 * --red-card is defined locally since styles.css names that colour differently.
 */
.psim {
  --red-card: #ef4444;
  max-width: 460px;
  margin: 22px auto;
  text-align: center;
}

/* street badge */
.psim .rp-street {
  display: inline-block;
  color: #c4b5fd;
  background: var(--brand-dim);
  border: 1px solid rgba(139,92,246,0.28);
  border-radius: 999px;
  padding: 4px 13px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 14px;
}

/* ── Dynamic poker table (mirrors the in-app hand review) ── */
.psim .rp-table { position: relative; width: 100%; height: 320px; margin: 4px auto 16px; overflow: visible; }
@media (max-width: 480px) { .psim .rp-table { height: 290px; } }

.psim .felt-outer, .psim .felt-inner { position: absolute; border-radius: 999px; }
.psim .felt-outer {
  left: 13%; top: 20%; width: 74%; height: 60%;
  background: linear-gradient(135deg, #3a2415, #241407);
  border: 1px solid rgba(0,0,0,0.55);
  box-shadow: 0 14px 34px -10px rgba(0,0,0,0.6);
}
.psim .felt-inner {
  left: 16.5%; top: 24.5%; width: 67%; height: 51%;
  overflow: hidden;
  background: linear-gradient(160deg, #1f8a44 0%, #176e36 55%, #0e4825 100%);
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: inset 0 0 40px rgba(0,0,0,0.4);
}
.psim .felt-spot { position: absolute; left: 15%; top: -22%; width: 70%; height: 55%; border-radius: 999px; background: rgba(255,255,255,0.10); }
.psim .felt-brand {
  position: absolute; top: 13%; left: 0; right: 0;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  opacity: 0.5; pointer-events: none;
}
.psim .felt-chip { width: 16px; height: 16px; border-radius: 5px; background: var(--brand-grad); display: grid; place-items: center; font-size: 10px; font-weight: 800; color: #fff; }
.psim .felt-brand span:last-child { color: rgba(255,255,255,0.85); font-size: 10px; font-weight: 800; letter-spacing: 2px; }

/* pot pill on the felt */
.psim .rp-pot { position: absolute; left: 0; right: 0; top: 30%; display: flex; justify-content: center; pointer-events: none; }
.psim .rp-pot-pill { display: inline-flex; align-items: baseline; gap: 7px; background: rgba(0,0,0,0.7); padding: 5px 13px; border-radius: 22px; border: 1px solid rgba(139,92,246,0.35); }
.psim .rp-pot-k { color: rgba(255,255,255,0.5); font-size: 9px; font-weight: 800; letter-spacing: 1.4px; }
.psim .rp-pot-v { color: #fff; font-size: 14px; font-weight: 800; }

/* board cards on the felt */
.psim .rp-board { position: absolute; left: 0; right: 0; top: 44%; display: flex; gap: 3px; justify-content: center; }
.psim .tcard {
  background: #fff; color: #111; border-radius: 5px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: "Georgia", serif; line-height: 1; box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.psim .tcard.red { color: var(--red-card); }
.psim .rp-board .tcard { width: 32px; height: 46px; }
.psim .rp-board .tcard .r { font-size: 13px; font-weight: 800; }
.psim .rp-board .tcard .s { font-size: 10px; }
.psim .tcard-empty { width: 32px; height: 46px; border-radius: 5px; border: 1px dashed rgba(255,255,255,0.2); }

/* seated player chips */
.psim .seat {
  position: absolute; width: 58px; box-sizing: border-box;
  transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  background: var(--surface-solid); border: 1px solid var(--border); border-radius: 9px;
  padding: 5px 4px; transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.psim .seat.current { border-color: var(--brand); background: var(--brand-dim); }
.psim .seat.hero { border-color: var(--brand); }
.psim .seat.folded { border-color: transparent; background: transparent; opacity: 0.5; }
.psim .seat.winner { border-color: #22c55e; background: rgba(34,197,94,0.18); box-shadow: 0 0 16px rgba(34,197,94,0.55); }
.psim .seat-pos { font-size: 11px; font-weight: 800; color: var(--text-secondary); }
.psim .seat.current .seat-pos, .psim .seat.hero .seat-pos { color: #c4b5fd; }
.psim .seat.winner .seat-pos { color: #22c55e; }
.psim .seat-stack { color: var(--text-muted); font-size: 9px; font-weight: 600; }
.psim .seat-state { font-size: 9px; font-weight: 800; margin-top: 1px; min-height: 11px; }
.psim .seat-cards { display: flex; gap: 2px; margin-top: 3px; }
.psim .seat-cards .tcard { width: 15px; height: 21px; }
.psim .seat-cards .tcard .r { font-size: 8px; font-weight: 900; }
.psim .seat-cards .tcard .s { font-size: 6px; }
.psim .seat-pill { position: absolute; top: -15px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,0.72); border-radius: 5px; padding: 2px 5px; font-size: 8px; font-weight: 800; color: #fff; white-space: nowrap; }
.psim .seat-pill.winner { background: rgba(34,197,94,0.9); }

/* bet chips floating in front of each player */
.psim .bet-float { position: absolute; transform: translate(-50%, -50%); background: #eab308; color: #000; border-radius: 10px; padding: 2px 6px; font-size: 10px; font-weight: 800; min-width: 38px; text-align: center; }

/* playing-card pips (hero strip + showdown reveals) */
.psim .pip-row { display: flex; gap: 7px; justify-content: center; flex-wrap: wrap; }
.psim .pip {
  min-width: 46px; height: 64px; background: #fff; color: #111; border-radius: 10px;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800; padding: 0 8px; line-height: 1.1;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4); font-family: "Georgia", serif; letter-spacing: -0.5px; gap: 1px;
}
.psim .pip .rank { font-size: 16px; }
.psim .pip .suit { font-size: 14px; line-height: 1; }
.psim .pip.red { color: var(--red-card); }

/* hero hole-card strip below the table */
.psim .rp-hero { display: flex; align-items: center; justify-content: center; gap: 14px; background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; }
.psim .rp-hero .pip-row { gap: 7px; }
.psim .rp-hero-meta { display: flex; align-items: center; gap: 8px; }
.psim .rp-pos { background: var(--brand-dim); color: #c4b5fd; border: 1px solid rgba(139,92,246,0.3); border-radius: 6px; padding: 3px 9px; font-size: 12px; font-weight: 800; }
.psim .rp-handed { color: var(--text-muted); font-size: 12px; font-weight: 600; }

/* action line */
.psim .rp-action { font-size: 15px; font-weight: 700; letter-spacing: -0.2px; margin-bottom: 14px; min-height: 20px; }
.psim .rp-action .who { color: var(--text-secondary); font-weight: 600; }
.psim .rp-action.is-hero .who { color: #a78bfa; }
.psim .rp-action .act-fold { color: var(--text-muted); }
.psim .rp-action .act-raise { color: #f9a8d4; }
.psim .rp-action .act-call { color: #93c5fd; }

/* annotation note (teaching layer, only rendered when annotations are supplied) */
.psim .psim-note {
  text-align: left; font-size: 14px; line-height: 1.6; color: var(--text-secondary);
  background: rgba(139,92,246,0.06); border: 1px solid rgba(139,92,246,0.22);
  border-left: 3px solid var(--brand); border-radius: 0 var(--radius) var(--radius) 0;
  padding: 13px 15px; margin-bottom: 14px; min-height: 66px;
}

/* math panel */
.psim .rp-math { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.psim .rp-stat { background: rgba(255,255,255,0.04); border: 1px solid var(--border); border-radius: 12px; padding: 10px 6px; display: flex; flex-direction: column; gap: 3px; }
.psim .rp-stat-k { color: var(--text-muted); font-size: 10px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; }
.psim .rp-stat-v { color: var(--text); font-size: 16px; font-weight: 800; letter-spacing: -0.3px; }

/* equity */
.psim .rp-equity { background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; text-align: left; }
.psim .rp-equity .rp-label { color: var(--text-muted); font-size: 10px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: baseline; }
.psim .rp-bar { display: flex; height: 12px; border-radius: 7px; overflow: hidden; background: rgba(255,255,255,0.06); }
.psim .rp-bar span { display: block; height: 100%; transition: width 0.35s ease; }
.psim .rp-bar-win { background: linear-gradient(90deg,#34d399,#10b981); }
.psim .rp-bar-tie { background: #fbbf24; }
.psim .rp-bar-lose { background: rgba(255,255,255,0.10); }
.psim .rp-eqrow { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12px; font-weight: 700; }
.psim .rp-eqrow span:nth-child(1) { color: #34d399; }
.psim .rp-eqrow span:nth-child(2) { color: #fbbf24; }
.psim .rp-eqrow span:nth-child(3) { color: var(--text-muted); }

/* showdown reveals */
.psim .rp-showdown { background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; }
.psim .rp-sd-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); }
.psim .rp-sd-row:first-of-type { border-top: none; }
.psim .rp-sd-seat { width: 52px; text-align: left; font-size: 12px; font-weight: 700; color: var(--text-secondary); }
.psim .rp-sd-row.winner .rp-sd-seat { color: #fcd34d; }
.psim .rp-sd-cards { display: flex; gap: 5px; }
.psim .rp-sd-cards .pip { min-width: 34px; height: 46px; font-size: 14px; }
.psim .rp-sd-cards .pip .rank { font-size: 13px; }
.psim .rp-sd-cards .pip .suit { font-size: 11px; }
.psim .rp-sd-desc { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }
.psim .rp-sd-row.winner .rp-sd-desc { color: #fcd34d; }
.psim .rp-sd-trophy { font-size: 13px; }

/* controls */
.psim .rp-controls { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 16px; }
.psim .rp-nav { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border-strong); background: rgba(255,255,255,0.05); color: var(--text); font-size: 22px; font-weight: 700; cursor: pointer; line-height: 1; transition: background 0.15s, transform 0.15s, opacity 0.15s; font-family: inherit; }
.psim .rp-nav:hover:not(:disabled) { background: rgba(255,255,255,0.1); transform: translateY(-1px); }
.psim .rp-nav:disabled { opacity: 0.3; cursor: default; }
.psim .rp-count { font-size: 13px; font-weight: 700; color: var(--text-secondary); min-width: 56px; }
.psim .psim-play { padding: 9px 20px; border-radius: 999px; border: 1px solid rgba(139,92,246,0.4); background: rgba(139,92,246,0.14); color: #c4b5fd; font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit; transition: background 0.15s; }
.psim .psim-play:hover { background: rgba(139,92,246,0.24); }
.psim .psim-play.playing { color: var(--text); }

/* full history dropdown */
.psim .rp-history { text-align: left; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 4px; overflow: hidden; }
.psim .rp-history summary { cursor: pointer; list-style: none; padding: 12px 14px; font-size: 13px; font-weight: 700; color: var(--text-secondary); display: flex; align-items: center; justify-content: space-between; }
.psim .rp-history summary::-webkit-details-marker { display: none; }
.psim .rp-history summary::after { content: "▾"; color: var(--text-muted); transition: transform 0.2s; }
.psim .rp-history[open] summary::after { transform: rotate(180deg); }
.psim .rp-history-body { padding: 0 14px 12px; }
.psim .rp-hist-street { margin-top: 10px; }
.psim .rp-hist-street-name { font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 5px; }
.psim .rp-hist-line { font-size: 13px; color: var(--text-secondary); padding: 2px 0; }
.psim .rp-hist-line .who { color: var(--text); font-weight: 600; }
.psim .rp-hist-line.hero .who { color: #a78bfa; }
.psim .rp-hist-board { font-size: 12.5px; color: var(--text-muted); font-style: italic; padding: 2px 0 4px; }
