*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0a1a0a;
  --felt:      #0f2d0f;
  --surface:   #161b22;
  --border:    #30363d;
  --green:     #2ea043;
  --green-dk:  #1a5c2a;
  --red:       #da3633;
  --yellow:    #e3b341;
  --gold:      #f5c518;
  --text:      #e6edf3;
  --muted:     #8b949e;
  --radius:    10px;
  --gap:       12px;
}

html { font-size: 16px; background: var(--bg); color: var(--text);
       -webkit-user-select: none; user-select: none;
       -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
       touch-action: manipulation; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  touch-action: manipulation;
}

/* ── Header ───────────────────────────────────────────────────────────── */

header {
  background: #0a0a0a;
  border-bottom: 1px solid #1a1a1a;
  padding: 10px 14px;
  padding-top: calc(10px + env(safe-area-inset-top));
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
header h1 { font-size: 1.1rem; font-weight: 800; letter-spacing: .02em; }
.table-mode-icon {
  font-weight: 400;
  font-size: 0.95rem;
  margin-left: 2px;
  vertical-align: baseline;
}

.status-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .04em;
  max-width: 46vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.status-badge.ok   { background: #1a3a26; color: var(--green); }
.status-badge.bad  { background: #2a1a1a; color: var(--red); }
.status-badge.warn { background: #3a2e10; color: var(--yellow); }

/* Connection banner — plain-language status while not Live */
.conn-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #2a2410;
  border-bottom: 1px solid rgba(227, 179, 65, 0.35);
  flex-shrink: 0;
  z-index: 20;
}
.conn-banner.hidden { display: none; }
.conn-banner.conn-failed {
  background: #2a1414;
  border-bottom-color: rgba(218, 54, 51, 0.4);
}
.conn-banner-msg {
  flex: 1;
  font-size: 0.8rem;
  line-height: 1.35;
  color: var(--text);
  min-width: 0;
}
.conn-banner #connRetryBtn {
  flex-shrink: 0;
  touch-action: manipulation;
}

/* ── Screens ──────────────────────────────────────────────────────────── */

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.screen.hidden { display: none; }

/* ── Join screen ──────────────────────────────────────────────────────── */

.join-card {
  margin: auto;
  width: min(320px, 90vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.join-card h2 { font-size: 1.15rem; font-weight: 700; text-align: center; }
.join-error {
  font-size: 0.85rem;
  color: var(--red);
  line-height: 1.35;
  text-align: center;
}
.join-error.hidden { display: none; }
/* ── Home Screen install coach (family-friendly) ─────────────────────── */

.install-help-btn {
  font-size: 0.88rem !important;
  color: var(--gold) !important;
  border: 1px dashed rgba(245, 197, 24, 0.35) !important;
  white-space: normal;
  line-height: 1.3;
  min-height: 48px;
  padding: 10px 14px !important;
}
.install-help-btn.hidden { display: none; }

.install-nudge {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  z-index: 45;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(12, 28, 12, 0.96);
  border: 1px solid rgba(245, 197, 24, 0.35);
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.45);
}
.install-nudge.hidden { display: none; }
.install-nudge-text {
  flex: 1 1 100%;
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--text);
}

.install-modal .install-modal-box {
  max-width: min(400px, 94vw);
  max-height: min(90dvh, 640px);
  display: flex;
  flex-direction: column;
}
.install-modal-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.install-lead {
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--muted);
  margin-bottom: 16px;
}
.install-lead strong { color: var(--text); }

.install-steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0 0 14px;
  padding: 0;
}
.install-steps li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.install-step-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--green-dk);
  color: var(--green);
  font-weight: 800;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.install-steps strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 4px;
  color: var(--text);
}
.install-steps p {
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--muted);
  margin: 0;
}
.install-share-icon {
  display: inline-block;
  padding: 0 4px;
  color: var(--gold);
  font-weight: 800;
}
.install-note {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
  margin-bottom: 14px;
  padding: 10px;
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
}
.install-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Arrow hint toward Safari bottom chrome while guide is open */
.install-arrow {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(4px + env(safe-area-inset-bottom));
  z-index: 70;
  text-align: center;
  pointer-events: none;
  animation: installBounce 1.2s ease-in-out infinite;
}
.install-arrow.hidden { display: none; }
.install-arrow-label {
  display: inline-block;
  background: rgba(245, 197, 24, 0.95);
  color: #1a1200;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 6px 12px;
  border-radius: 20px;
  margin-bottom: 4px;
}
.install-arrow-chevron {
  font-size: 1.4rem;
  color: var(--gold);
  line-height: 1;
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
}
@keyframes installBounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(6px); }
}
input.input-error { border-color: var(--red) !important; outline: none; animation: shake 0.25s; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25%      { transform: translateX(-6px); }
  75%      { transform: translateX(6px); }
}

/* ── Game screen layout ───────────────────────────────────────────────── */

#gameScreen {
  background: var(--felt);
  gap: 0;
  padding-bottom: env(safe-area-inset-bottom);
}

/* Opponents */
.opponents-area {
  padding: 10px 10px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.opponent-seat {
  background: rgba(0,0,0,0.35);
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.opponent-seat .opp-info {
  flex: 1;
  min-width: 0;
}
.opponent-seat.winner { outline: 2px solid var(--gold); }

/* Right column: place (showdown) + last action / thinking */
.seat-status-col {
  flex: 0 0 auto;
  min-width: 4.8rem;
  max-width: 38%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 4px;
  padding-left: 6px;
  align-self: stretch;
}
.seat-status-col .hand-place {
  margin-right: 0;
}
.seat-status {
  text-align: right;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--muted);
}
.seat-status.status-your-turn {
  color: var(--green);
  font-size: 0.82rem;
}
.seat-status.status-thinking {
  color: var(--yellow);
  font-style: italic;
  animation: thinkingPulse 1.1s ease-in-out infinite;
}
.seat-status.status-fold { color: #c07070; font-weight: 600; }
.seat-status.status-blind { color: var(--gold); font-weight: 700; }
.seat-status.status-call { color: #7eb8e8; }
.seat-status.status-aggro { color: #7dcea0; }
.seat-status.status-acted { color: var(--text); }
.seat-status.status-next-up {
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}
@keyframes thinkingPulse {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}
/* Folded seat that would have beaten the showdown winner — learning highlight */
.opponent-seat.would-have-won-seat {
  outline: 2px dashed rgba(100, 200, 255, 0.65);
  opacity: 1;
}
/* At showdown, full-strength text — "folded ·" prefix carries the cue */
.opponent-hand-label.folded-hand {
  color: var(--text);
  font-weight: 600;
  opacity: 0.92;
}
.opponent-hand-label.would-have-won {
  color: #7ec8ff;
  font-weight: 700;
}
.opponent-hand-label.would-have-tied {
  color: #a8d4ff;
  font-weight: 600;
}

/* Showdown hand-strength place (1st/2nd/…) — fold ignored */
.hand-place {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 2px 6px;
  border-radius: 6px;
  margin-right: 6px;
  vertical-align: middle;
  line-height: 1.2;
  flex-shrink: 0;
}
.hand-place.place-1 {
  background: rgba(245, 197, 24, 0.25);
  color: var(--gold);
  border: 1px solid rgba(245, 197, 24, 0.5);
}
.hand-place.place-2 {
  background: rgba(180, 190, 210, 0.2);
  color: #c8d0e0;
  border: 1px solid rgba(180, 190, 210, 0.4);
}
.hand-place.place-3 {
  background: rgba(180, 120, 60, 0.25);
  color: #e0a870;
  border: 1px solid rgba(180, 120, 60, 0.45);
}
.hand-place.place-n {
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Staged showdown flip */
.opponent-seat.reveal-seat {
  outline: 2px solid rgba(245, 197, 24, 0.7);
  outline-offset: 2px;
  background: rgba(60, 50, 10, 0.35);
}
.card-flip-in {
  display: inline-flex;
  gap: inherit;
  animation: cardFlipIn 0.45s ease-out;
}
@keyframes cardFlipIn {
  from { transform: rotateY(90deg) scale(0.9); opacity: 0.3; }
  to   { transform: rotateY(0) scale(1); opacity: 1; }
}
.seat-status.status-waiting-reveal {
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.12em;
}
.opponent-name { font-size: 0.85rem; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opponent-hand-label { font-size: 0.75rem; color: var(--gold); font-weight: 600; }

/* Community area */
.community-area {
  padding: 14px 10px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.community-cards {
  min-height: 80px;
  justify-content: center;
  background: rgba(0,0,0,0.2);
  border-radius: 10px;
  padding: 10px;
  width: 100%;
}

.phase-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 600;
  min-height: 16px;
}

.dealer-label {
  font-size: 0.72rem;
  color: var(--gold);
  font-weight: 600;
}
.dealer-label.hidden { display: none; }

/* Action bar */
.action-bar {
  padding: 10px;
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Betting controls container (your turn only) */
.my-seat {
  background: rgba(0,0,0,0.4);
  border-top: 1px solid rgba(255,255,255,0.07);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.my-seat.hidden { display: none; }

/* Chat */
.chat-toggle-row {
  display: flex;
  gap: 8px;
  padding: 6px 10px;
  border-top: 1px solid rgba(255,255,255,0.05);
}
.chat-panel {
  background: rgba(0,0,0,0.5);
  border-top: 1px solid var(--border);
}
.chat-panel.hidden { display: none; }
.chat-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}
.tab-btn {
  flex: 1;
  padding: 6px 4px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 0.75rem;
  cursor: pointer;
}
.tab-btn.active {
  color: var(--green);
  border-bottom-color: var(--green);
}
.badge {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: var(--red);
  border-radius: 50%;
  margin-left: 3px;
  vertical-align: middle;
  font-size: 0;
}
.badge.hidden   { display: none; }
.feed.hidden    { display: none; }
.chat-input-row.hidden { display: none; }
.feed {
  display: flex;
  flex-direction: column;
  gap: 2px;
  /* Tall enough to retrace an orbit (all-in / calls) without squinting */
  max-height: min(40vh, 320px);
  min-height: 120px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 10px 4px;
}
.feed-line {
  font-size: 0.75rem;
  font-family: "SF Mono", "Menlo", monospace;
  padding: 2px 0;
  color: var(--muted);
  word-break: break-word;
}
.feed-line.ok    { color: var(--green); }
.feed-line.bad   { color: var(--red); }
.feed-line.chat  { color: var(--yellow); }
.feed-line.muted { color: var(--border); text-align: center; font-style: italic; }
/* All-ins — easy to spot when scrolling back through a street */
.feed-line.allin {
  color: var(--yellow);
  font-weight: 600;
}
/* New hand / deal — clear section break when scrolling the log */
.feed-line.hand-start {
  margin-top: 10px;
  padding: 6px 0 2px;
  border-top: 2px solid rgba(80, 200, 100, 0.55);
  color: var(--green);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  font-style: normal;
}
.feed-line.hand-start-detail {
  color: var(--green);
  opacity: 0.9;
  text-align: center;
  padding-bottom: 4px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(80, 200, 100, 0.25);
}

.chat-input-row {
  display: flex;
  gap: 6px;
  padding: 6px 10px 8px;
}

/* ── Cards ────────────────────────────────────────────────────────────── */

.card-row {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.card {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 62px;
  border-radius: 5px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
  font-weight: 800;
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
  position: relative;
}
.card .card-rank { font-size: 0.9rem; }
.card .card-suit { font-size: 1rem; }
.card.red   { color: #c00; }
.card.black { color: #111; }
.card.back  {
  background: linear-gradient(135deg, #1a3a8f 25%, #1e2d6e 75%);
  color: rgba(255,255,255,0.3);
  font-size: 1.4rem;
}
.card.community {
  width: 50px;
  height: 70px;
}
.card.placeholder {
  background: rgba(255,255,255,0.05);
  border: 2px dashed rgba(255,255,255,0.12);
  box-shadow: none;
}

/* ── Pot & community meta ─────────────────────────────────────────────── */

.community-meta {
  display: flex;
  align-items: center;
  gap: 14px;
}

.pot-display {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--gold);
  background: rgba(245, 197, 24, 0.12);
  border-radius: 20px;
  padding: 2px 10px;
}
.pot-display.hidden { display: none; }

.current-bet-display {
  font-size: 0.82rem;
  font-weight: 700;
  color: #7ec8f7;
  background: rgba(80, 160, 230, 0.12);
  border-radius: 20px;
  padding: 2px 10px;
}
.current-bet-display.hidden { display: none; }

.money-line { display: flex; align-items: baseline; gap: 5px; font-size: 0.72rem; flex-wrap: nowrap; }
.ml-stack    { color: var(--text); font-weight: 600; }
.ml-total    { color: var(--muted); }
.ml-in-front { color: #f5c518; font-weight: 700; }
.ml-net-win  { color: var(--green); font-weight: 700; }
.ml-net-loss { color: var(--red);   font-weight: 700; }
.ml-debt     { color: var(--red);   font-weight: 600; margin-left: auto; }

/* ── Seat badges (D / SB / BB) ────────────────────────────────────────── */

.seat-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 800;
  border-radius: 4px;
  padding: 1px 5px;
  vertical-align: middle;
  letter-spacing: .04em;
  margin-left: 3px;
}
.seat-badge.dealer { background: rgba(245,197,24,0.15); color: var(--gold); border: 1px solid rgba(245,197,24,0.4); }
.seat-badge.sb     { background: #1a3a8f; color: #a0c0ff; }
.seat-badge.bb     { background: #3a1a1a; color: #ff9090; }
.seat-badge.allin  { background: rgba(220,50,50,0.18); color: #ff7070; border: 1px solid rgba(220,50,50,0.4); }
.seat-badge.bot    { background: rgba(0,180,180,0.15); color: #4dd9d9; border: 1px solid rgba(0,180,180,0.4); }

.bot-style {
  font-weight: 600;
  font-size: 0.72em;
  color: var(--muted);
  text-transform: none;
}

/* ── Bot controls ─────────────────────────────────────────────────────── */

.bot-controls {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0 10px 6px;
}
.bot-controls:empty { padding: 0; }

.opp-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.last-action { font-size: 0.72rem; color: var(--muted); font-style: italic; }
.you-tag { color: var(--muted); font-size: 0.78rem; font-weight: 400; }

/* ── Folded seat styling ──────────────────────────────────────────────── */

/* Only mid-hand (class applied when phase !== showdown) */
.folded-seat { opacity: 0.65; }
.folded-cards { opacity: 0.55; }

/* ── Peek mode (revealed bot cards for learning) ──────────────────────── */

.peek-cards { outline: 1px solid rgba(0, 200, 180, 0.5); border-radius: 4px; }

/* ── Acted trail (this street) vs active turn ─────────────────────────── */
/* Light ring = already spoken; strong pulse = to act now. */

.opponent-seat.has-acted {
  outline: 1.5px solid rgba(80, 200, 100, 0.4);
  outline-offset: 2px;
  background: rgba(20, 50, 28, 0.4);
}

/* Active seat (their turn) — always obvious while stepping bots */
.active-seat {
  outline: 2px solid var(--green);
  outline-offset: 2px;
  background: rgba(30, 90, 40, 0.35);
  box-shadow: 0 0 0 1px rgba(80, 200, 100, 0.25), 0 0 14px rgba(40, 140, 60, 0.25);
  animation: activeSeatPulse 1.6s ease-in-out infinite;
}
@keyframes activeSeatPulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(80, 200, 100, 0.25), 0 0 10px rgba(40, 140, 60, 0.2); }
  50%      { box-shadow: 0 0 0 2px rgba(100, 220, 120, 0.45), 0 0 18px rgba(60, 180, 80, 0.4); }
}
/* One-shot attention flash when action first lands on a seat (2 quick blinks) */
.opponent-seat.active-seat.active-seat-alert {
  animation:
    activeSeatAlert 0.4s ease-in-out 2,
    activeSeatPulse 1.6s ease-in-out 0.8s infinite;
}
@keyframes activeSeatAlert {
  0%, 100% {
    outline-color: var(--green);
    background: rgba(30, 90, 40, 0.35);
    box-shadow: 0 0 0 1px rgba(80, 200, 100, 0.25), 0 0 14px rgba(40, 140, 60, 0.25);
  }
  50% {
    outline-color: #b8ffc0;
    outline-width: 3px;
    background: rgba(60, 160, 80, 0.55);
    box-shadow: 0 0 0 3px rgba(140, 255, 160, 0.55), 0 0 28px rgba(80, 220, 100, 0.55);
  }
}
.seat-disconnected { opacity: 0.5; }
.away-label { font-size: 0.65rem; color: var(--muted); font-style: italic; }



/* ── Betting action panel ─────────────────────────────────────────────── */

.betting-actions {
  width: 100%;
  padding: 6px 0 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.betting-actions.hidden { display: none; }

.bet-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 420px;
  padding: 0 6px;
  box-sizing: border-box;
}

/*
 * Buttons size to content and wrap as needed.
 * Fold stays compact; Call/Raise get room for amounts; All-in is NOT full-width.
 */
.btn-act {
  flex: 0 1 auto;
  min-width: 4.2rem;
  min-height: 46px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  border: 2px solid transparent;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
  transition: transform 0.08s ease, filter 0.08s ease, box-shadow 0.08s ease;
  white-space: nowrap;
}
.btn-act:active:not(:disabled),
.btn-act.btn-hit:not(:disabled) {
  transform: scale(0.96);
  filter: brightness(1.35);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35), 0 0 12px rgba(180, 255, 200, 0.35);
}

.btn-act-fold {
  flex: 0 0 auto;
  min-width: 3.6rem;
  max-width: 5rem;
  padding: 0 10px;
  background: rgba(80, 20, 20, 0.55);
  color: #ffb4b0;
  border-color: rgba(220, 80, 70, 0.65);
}
.btn-act-call {
  flex: 1 1 auto;
  min-width: 5rem;
  max-width: 11rem;
  background: #1a6fbf;
  color: #fff;
  border-color: #2b8ae0;
  box-shadow: 0 0 0 1px rgba(80, 180, 255, 0.25), 0 2px 8px rgba(20, 80, 160, 0.35);
}
.btn-act-raise {
  flex: 1 1 auto;
  min-width: 5.5rem;
  max-width: 12rem;
  min-height: 48px;
  padding: 0 14px;
  font-size: 0.92rem;
  background: var(--green);
  color: #fff;
  border-color: #3ecf5a;
  box-shadow: 0 0 0 1px rgba(80, 220, 100, 0.2), 0 2px 8px rgba(20, 80, 40, 0.3);
}
.btn-act-allin {
  /* Same “chip” size as others — never stretch alone across the row */
  flex: 0 1 auto;
  min-width: 4.5rem;
  max-width: 7.5rem;
  background: #9a1f1f;
  color: #ffe0e0;
  border-color: #d04040;
  box-shadow: 0 0 0 1px rgba(255, 100, 100, 0.2), 0 2px 8px rgba(80, 10, 10, 0.35);
}

/* Double-tap confirm still wins for fold / all-in */
.btn-act.btn-confirming {
  background: rgba(200, 100, 0, 0.55) !important;
  color: #ffdd99 !important;
  border-color: rgba(240, 160, 40, 0.9) !important;
  box-shadow: none !important;
}

.call-context {
  font-size: 0.74rem;
  color: #7ec8f7;
  padding: 2px 8px 0;
  text-align: center;
  max-width: 100%;
  line-height: 1.35;
  word-break: break-word;
}
.call-context.hidden { display: none; }

.raise-context {
  font-size: 0.74rem;
  color: var(--muted);
  line-height: 1.5;
  padding: 6px 2px 2px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.raise-context.hidden { display: none; }
.raise-context .rc-why   { color: var(--text); margin-bottom: 3px; }
.raise-context .rc-extra { color: var(--muted); }

.raise-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.raise-row.hidden { display: none; }

.raise-amt-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 60px;
}
.raise-amt {
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  color: var(--text);
}
.raise-hint {
  font-size: 0.62rem;
  color: var(--muted);
  white-space: nowrap;
}

/* ── Coach panel ──────────────────────────────────────────────────────── */

.coach-panel {
  margin: 0 10px 6px;
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 10px 14px;
  min-height: 52px;
}
.coach-what {
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 4px;
}
.coach-next {
  font-size: 0.78rem;
  color: var(--green);
  font-weight: 600;
}
.coach-next::before { content: '▶ '; }

/* ── Equity bar ───────────────────────────────────────────────────────── */

.equity-bar {
  margin-bottom: 8px;
  padding-bottom: 7px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 6px;
}
.equity-bar.hidden { display: none; }
.eq-label { color: var(--muted); }
.eq-val   { color: var(--text); font-weight: 700; }
.eq-muted { color: var(--muted); font-size: 0.72rem; }
.eq-sep   { color: var(--muted); opacity: 0.5; }
.eq-good  { color: var(--green); font-weight: 700; }
.eq-bad   { color: var(--red);   font-weight: 700; }

/* ── Hand progress map ────────────────────────────────────────────────── */

.hand-map {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px 2px;
  gap: 2px;
}
.hand-map.hidden { display: none; }

.map-step {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: .02em;
  padding: 2px 5px;
  border-radius: 4px;
  white-space: nowrap;
  color: rgba(255,255,255,0.18);
}
.map-step.done    { color: var(--green); }
.map-step.current { color: var(--text); background: rgba(255,255,255,0.08); }

.map-sep {
  font-size: 0.55rem;
  color: rgba(255,255,255,0.12);
  flex-shrink: 0;
}

.mode-active { color: var(--green) !important; }
.mode-disabled { opacity: 0.4; pointer-events: none; }

@keyframes ready-pulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--green); }
  50%       { box-shadow: 0 0 0 5px rgba(46,160,67,0.35); }
}
.btn-ready {
  outline: 2px solid var(--green);
  outline-offset: 2px;
  animation: ready-pulse 1.2s ease-in-out infinite;
}

/* Auto Deal / Next Street countdown fill */
.btn-auto-countdown {
  position: relative;
  overflow: hidden;
  outline: 2px solid var(--green);
  outline-offset: 2px;
  animation: none;
  background-image: linear-gradient(
    90deg,
    rgba(46, 160, 67, 0.45) 0%,
    rgba(46, 160, 67, 0.45) var(--auto-fill, 0%),
    transparent var(--auto-fill, 0%)
  );
}

/* Current hand strength (shown in seat row while hand in progress) */
.opponent-hand-label.current-hand { color: #7dd3fc; font-style: italic; }

/* ── Modal ────────────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: flex-end;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}
.modal-overlay.hidden { display: none; }

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px 14px 0 0;
  width: 100%;
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h2 { font-size: 1rem; font-weight: 700; }
.modal-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px 14px 20px;
}

.hand-ref-list { display: flex; flex-direction: column; gap: 2px; }
.hand-ref-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.hand-ref-item:last-child { border-bottom: none; }
.hand-ref-item.best .hand-ref-name { color: var(--gold); }
.hand-ref-item.worst .hand-ref-name { color: var(--muted); }

.hand-ref-name {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.hand-ref-cards {
  font-size: 1rem;
  letter-spacing: .06em;
  margin-bottom: 3px;
}
.hand-ref-cards .r { color: #c00; }
.hand-ref-cards .b { color: #e6edf3; }
.hand-ref-desc {
  font-size: 0.78rem;
  color: var(--muted);
}
.modal-note {
  margin-top: 14px;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
  padding: 10px;
  background: rgba(255,255,255,0.04);
  border-radius: 6px;
}

/* ── Long-press help (sticky modal — dismiss with ✕ or outside) ───────── */

.tooltip-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  box-sizing: border-box;
}
.tooltip-overlay.hidden { display: none; }

.tooltip-panel {
  width: 100%;
  max-width: 520px;
  background: rgba(10, 24, 10, 0.98);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 14px;
  padding: 14px 16px 12px;
  box-shadow: 0 -4px 28px rgba(0,0,0,0.6);
  /* Keep help open after finger lifts — not a press-and-hold native tooltip */
  pointer-events: auto;
}

.tooltip-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}
.tooltip-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--gold);
  margin-bottom: 0;
  flex: 1;
}
.tooltip-close {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.tooltip-body {
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.55;
}
.tooltip-hint {
  margin-top: 10px;
  font-size: 0.68rem;
  color: var(--muted);
  text-align: right;
  font-style: italic;
}

/* ── Buttons ──────────────────────────────────────────────────────────── */

button {
  border: none;
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
  min-height: 44px;
  padding: 0 18px;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  transition: opacity .15s;
  touch-action: manipulation;
}
button:disabled { opacity: 0.35; cursor: default; }
button:active:not(:disabled) { opacity: 0.75; }

.btn-primary   { background: var(--green);   color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-ghost     { background: transparent;    color: var(--muted); font-size: 0.82rem; min-height: 36px; padding: 0 12px; }
/* Legacy all-in class kept for any stragglers; prefer .btn-act-allin on the action bar */
.btn-allin     { background: #9a1f1f; color: #ffe0e0; border: 2px solid #d04040; }
.btn-ghost.danger { color: var(--red); }
.btn-ghost.ai-copied-ok  { color: var(--green); font-weight: 700; }
.btn-ghost.ai-copied-bad { color: var(--yellow, #c9a227); font-weight: 700; }
.btn-confirming   { background: rgba(200,100,0,0.35) !important; color: #ffbb66 !important; border: 1px solid rgba(200,100,0,0.5) !important; }

.cancel-row         { display: flex; align-items: center; justify-content: center; width: 100%; }
.cancel-row.hidden  { display: none; }
#cancelBtn {
  min-height: 48px;
  min-width: 10rem;
  padding: 10px 22px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 10px;
  border: 2px solid rgba(220, 80, 70, 0.55);
}
#raiseConfirm {
  min-height: 44px;
  padding: 8px 16px;
  font-size: 0.95rem;
  font-weight: 800;
}

/* Universal tap flash (iOS-friendly via .btn-hit) */
button:not(:disabled).btn-hit {
  filter: brightness(1.35);
  transform: scale(0.97);
}
button:active:not(:disabled) {
  filter: brightness(1.25);
  transform: scale(0.98);
}
.btn-large     { min-height: 52px; font-size: 1.05rem; width: 100%; }
.btn-small     { min-height: 34px; font-size: 0.8rem; padding: 0 12px; }

/* ── Form inputs ──────────────────────────────────────────────────────── */

input[type="text"] {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-size: 1rem;     /* 16px prevents iOS auto-zoom */
  padding: 10px 14px;
  outline: none;
  width: 100%;
}
input[type="text"]:focus { border-color: var(--green); }
