/* holdem — 德州撲克 */

.app {
  max-width: 980px;
  padding-bottom: 32px;
}

/* ── HUD ───────────────────────────────────────────────── */
.hud {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 12px 0;
}
.hud-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.hud-label { font-size: 11px; color: var(--text-muted); letter-spacing: 0.5px; }
.hud-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--accent);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hud-value.win  { color: #34a853; }
.hud-value.lose { color: #ef5350; }
.hud-value.small { font-size: 14px; line-height: 26px; }

/* ── Table ─────────────────────────────────────────────── */
.poker-table {
  --cw: 52px;            /* board / your cards */
  --ch: 74px;
  --sw: 34px;            /* computer hole cards */
  --sh: 48px;
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  margin: 8px 0 6px;
}
.felt {
  position: absolute;
  inset: 9% 7% 11%;
  border-radius: 50% / 50%;
  background:
    radial-gradient(ellipse at center, rgba(255,255,255,0.10), transparent 65%),
    linear-gradient(180deg, #1e6b45, #14512f);
  border: 10px solid #8b5a2b;
  box-shadow: inset 0 0 30px rgba(0,0,0,0.45), 0 6px 18px rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}
.center-area { text-align: center; color: #e8f5e9; }
.pot-line {
  font-size: 15px;
  font-weight: 800;
  min-height: 20px;
  font-variant-numeric: tabular-nums;
}
.pot-line b { color: #ffd54f; font-size: 17px; }
.pot-bets { font-size: 12px; font-weight: 600; opacity: 0.8; margin-left: 6px; }
.side-pots { font-size: 12px; font-weight: 700; color: #ffe082; min-height: 16px; margin-top: 4px; }
.board { display: flex; gap: 6px; justify-content: center; margin-top: 6px; min-height: var(--ch); }

/* ── Cards ─────────────────────────────────────────────── */
.card {
  width: var(--cw);
  height: var(--ch);
  border-radius: 6px;
  border: 1px solid #ccc;
  background: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3px 4px;
  font-weight: 800;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  animation: card-deal 0.28s ease backwards;
  user-select: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}
.card-face-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: fill; border-radius: inherit; pointer-events: none;
}
.card.red   { color: #d32f2f; }
.card.black { color: #1a1a1a; }
.card-rank-top { font-size: 14px; line-height: 1; }
.card-suit-center { font-size: 22px; line-height: 1; flex: 1; display: flex; align-items: center; justify-content: center; }
.card-rank-bot { font-size: 14px; line-height: 1; text-align: right; transform: rotate(180deg); }
.card.face-down {
  background: repeating-linear-gradient(45deg, #1565c0, #1565c0 4px, #1976d2 4px, #1976d2 8px);
  border-color: #0d47a1;
}
.card.slot {
  background: rgba(255,255,255,0.06);
  border: 2px dashed rgba(255,255,255,0.25);
  box-shadow: none;
  animation: none;
}
@keyframes card-deal {
  from { opacity: 0; transform: translateY(-24px) scale(0.85); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.card.flip-in { animation: card-flip 0.32s ease backwards; }
@keyframes card-flip {
  from { transform: rotateY(90deg); }
  to   { transform: rotateY(0); }
}
.card.win-card { transform: translateY(-6px); box-shadow: 0 0 0 3px #ffd54f, 0 0 14px rgba(255,213,79,0.9); }
.card.dim { opacity: 0.45; }

/* ── Seats ─────────────────────────────────────────────── */
.seat {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 128px;
  z-index: 2;
}
.seat-0 { left: 50%; top: 88%; width: 170px; }
.seat-1 { left: 11%; top: 72%; }
.seat-2 { left: 11%; top: 26%; }
.seat-3 { left: 50%; top: 9%; }
.seat-4 { left: 89%; top: 26%; }
.seat-5 { left: 89%; top: 72%; }

.seat-cards { display: flex; gap: 3px; min-height: var(--sh); margin-bottom: -10px; z-index: 1; }
.seat .seat-cards .card { width: var(--sw); height: var(--sh); padding: 2px 3px; }
.seat .seat-cards .card-rank-top, .seat .seat-cards .card-rank-bot { font-size: 11px; }
.seat .seat-cards .card-suit-center { font-size: 15px; }
.seat.me .seat-cards { min-height: var(--ch); }
.seat.me .seat-cards .card { width: var(--cw); height: var(--ch); padding: 3px 4px; }
.seat.me .seat-cards .card-rank-top, .seat.me .seat-cards .card-rank-bot { font-size: 14px; }
.seat.me .seat-cards .card-suit-center { font-size: 22px; }

.seat-box {
  position: relative;
  z-index: 2;
  width: 100%;
  background: rgba(20, 24, 32, 0.88);
  color: #fff;
  border: 2px solid rgba(255,255,255,0.18);
  border-radius: 12px;
  padding: 4px 8px 5px;
  text-align: center;
  box-shadow: 0 3px 8px rgba(0,0,0,0.35);
  transition: border-color 0.2s, box-shadow 0.2s, opacity 0.2s;
}
.seat-name { font-size: 13px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat-name .persona { margin-right: 4px; }
.seat-chips { font-size: 15px; font-weight: 800; color: #ffd54f; font-variant-numeric: tabular-nums; }
.seat-status { font-size: 11px; color: #b0bec5; min-height: 14px; white-space: nowrap; }

.seat.to-act .seat-box, .seat.thinking .seat-box {
  border-color: #ffd54f;
  box-shadow: 0 0 0 2px rgba(255,213,79,0.4), 0 0 14px rgba(255,213,79,0.6);
}
.seat.thinking .seat-status { color: #ffd54f; animation: think-blink 0.9s ease-in-out infinite; }
@keyframes think-blink { 50% { opacity: 0.35; } }
.seat.folded .seat-box { opacity: 0.5; }
.seat.folded .seat-cards { opacity: 0.4; }
.seat.allin .seat-status { color: #ff8a80; font-weight: 800; }
.seat.winner .seat-box { border-color: #66bb6a; box-shadow: 0 0 16px rgba(102,187,106,0.85); }
.seat.winner .seat-status { color: #b9f6ca; font-weight: 800; }
.seat.fresh .seat-box { border-color: #4fc3f7; }
.seat.empty { opacity: 0.5; }

.dealer-btn, .blind-tag {
  position: absolute;
  top: -9px;
  width: 22px; height: 22px;
  border-radius: 50%;
  font-size: 11px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}
.dealer-btn { right: -8px; background: #fff; color: #222; border: 2px solid #999; }
.blind-tag { left: -8px; background: #42a5f5; color: #fff; font-size: 9px; }
.blind-tag.bb { background: #ef6c00; }
.dealer-btn[hidden], .blind-tag[hidden], .seat-bet[hidden], .seat-hand[hidden] { display: none; }

.seat-bet {
  position: absolute;
  padding: 2px 8px 2px 22px;
  border-radius: 999px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  z-index: 3;
}
.seat-bet::before {
  content: "";
  position: absolute;
  left: 4px; top: 50%;
  width: 14px; height: 14px;
  margin-top: -7px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #f39c12, #b9770e);
  border: 2px dashed #fff;
  box-sizing: border-box;
}
.seat-bet.pop { animation: bet-pop 0.35s cubic-bezier(.2,1.4,.5,1); }
@keyframes bet-pop {
  from { transform: scale(0.3); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
/* bets sit on the felt, toward the centre */
.seat-0 .seat-bet { top: -26px; left: 50%; margin-left: 70px; }
.seat-1 .seat-bet, .seat-2 .seat-bet { left: 100%; margin-left: 8px; top: 55%; }
.seat-4 .seat-bet, .seat-5 .seat-bet { right: 100%; margin-right: 8px; top: 55%; }
.seat-3 .seat-bet { top: 100%; margin-top: 6px; }

.seat-hand {
  margin-top: 3px;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.92);
  color: #333;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  z-index: 3;
}
.seat-hand.win { background: linear-gradient(135deg, #ffd700, #f0a500); color: #3a2500; }

/* ── Under the table ───────────────────────────────────── */
.my-hand {
  text-align: center;
  font-size: 14px;
  min-height: 20px;
  color: var(--text-strong);
}
.my-hand b { color: var(--accent); }

.result-banner {
  text-align: center;
  margin: 6px auto;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: rgba(0,0,0,0.78);
  color: #fff;
  max-width: 560px;
  animation: banner-pop 0.35s cubic-bezier(.2,1.4,.5,1);
}
.result-banner[hidden] { display: none; }
.banner-head { font-size: 20px; font-weight: 900; }
.banner-sub  { font-size: 13px; opacity: 0.92; margin-top: 2px; }
.banner-sub.bust { color: #ffcdd2; font-weight: 700; }
.result-banner.win  .banner-head { color: #ffd54f; }
.result-banner.lose .banner-head { color: #ff8a80; }
@keyframes banner-pop {
  from { transform: scale(0.7); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* ── Action bar ────────────────────────────────────────── */
.action-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 8px 10px 4px;
  margin: 8px auto;
  max-width: 560px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.action-panel.my-turn { border-color: #ffb300; box-shadow: 0 0 0 2px rgba(255,179,0,0.35), var(--shadow-sm); }
.turn-hint { text-align: center; font-size: 13px; font-weight: 700; color: var(--text-muted); min-height: 18px; }
.action-panel.my-turn .turn-hint { color: var(--accent); }
.raise-box.off { opacity: 0.45; }
.quick-row { display: flex; gap: 6px; justify-content: center; margin: 6px 0 4px; }
.quick-row .btn { min-width: 0; flex: 1; max-width: 90px; padding: 6px 4px; font-size: 13px; }
.slider-row { display: flex; align-items: center; gap: 10px; padding: 0 4px; }
.slider-row input[type=range] { flex: 1; accent-color: #f0a500; }
.raise-amount {
  min-width: 58px;
  text-align: right;
  font-weight: 900;
  font-size: 18px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.action-row { display: flex; justify-content: center; gap: 8px; margin: 8px 0; }
.action-row .btn { min-width: 110px; font-weight: 700; }
.btn.act { flex: 1; max-width: 170px; }
.btn.act.fold:not(:disabled)  { background: linear-gradient(180deg, #78909c, #546e7a); color: #fff; border: none; }
.btn.act.call:not(:disabled)  { background: linear-gradient(180deg, #43a047, #2e7d32); color: #fff; border: none; }
.btn.act.raise:not(:disabled) { background: linear-gradient(180deg, #f39c12, #d35400); color: #fff; border: none; }
.action-row .btn.primary {
  background: linear-gradient(180deg, #e74c3c, #c0392b);
  color: #fff;
  border: none;
  animation: deal-glow 1.6s ease-in-out infinite alternate;
}
.action-row .btn.primary[hidden] { display: none; }
@keyframes deal-glow {
  0%   { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0); }
  100% { box-shadow: 0 0 18px 4px rgba(255, 215, 0, 0.6); }
}
.between[hidden] { display: none; }
.auto-toggle {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 13px; color: var(--text-muted); cursor: pointer;
}

.legend { font-size: 12px; color: var(--text-muted); text-align: center; line-height: 1.6; }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 760px) {
  .poker-table { --cw: 44px; --ch: 63px; --sw: 28px; --sh: 40px; }
  .seat { width: 104px; }
  .seat-0 { width: 150px; }
  .seat-name { font-size: 12px; }
  .seat-chips { font-size: 13px; }
}
@media (max-width: 600px) {
  .hud { grid-template-columns: repeat(4, 1fr); gap: 4px; }
  .hud-box { padding: 6px 4px; }
  .hud-value { font-size: 16px; }
  .poker-table { aspect-ratio: 3 / 4; --cw: 40px; --ch: 57px; --sw: 24px; --sh: 34px; }
  .felt { inset: 10% 6% 15%; border-width: 7px; border-radius: 45% / 35%; }
  .seat { width: 84px; }
  .seat-0 { left: 50%; top: 90%; width: 140px; }
  .seat-1 { left: 13%; top: 66%; }
  .seat-2 { left: 13%; top: 30%; }
  .seat-3 { left: 50%; top: 8%; }
  .seat-4 { left: 87%; top: 30%; }
  .seat-5 { left: 87%; top: 66%; }
  .seat-box { padding: 2px 4px 3px; border-radius: 9px; }
  .seat-name { font-size: 11px; }
  .seat-name .persona { margin-right: 2px; }
  .seat-chips { font-size: 12px; }
  .seat-status { font-size: 10px; }
  .seat .seat-cards .card-rank-top, .seat .seat-cards .card-rank-bot { font-size: 9px; }
  .seat .seat-cards .card-suit-center { font-size: 11px; }
  .seat-1 .seat-bet, .seat-2 .seat-bet { left: 50%; margin-left: -10px; top: 100%; margin-top: 18px; }
  .seat-4 .seat-bet, .seat-5 .seat-bet { right: 50%; margin-right: -10px; top: 100%; margin-top: 18px; }
  .seat-0 .seat-bet { margin-left: 60px; }
  .board { gap: 3px; }
  .card-rank-top, .card-rank-bot { font-size: 12px; }
  .card-suit-center { font-size: 17px; }
  .action-row .btn { min-width: 0; }
  .btn.act { font-size: 14px; padding-left: 4px; padding-right: 4px; }
}
@media (max-width: 360px) {
  .poker-table { --cw: 34px; --ch: 49px; --sw: 22px; --sh: 31px; }
  .seat { width: 74px; }
}

/* Light mode: accent-gold HUD numbers on white were ~1.7:1 contrast. Darken the active accent
   (works with every profile accent colour); :where() keeps specificity at .hud-value so
   win/lose-coloured values still override it. Dark mode keeps the bright accent. */
:where(body:not(.dark)) .hud-value { color: color-mix(in srgb, var(--accent) 55%, #000); }
