/* ===================================================================
   BTO Hold'em — Brothers Portal poker table
   Loaded only on /brothers. Everything is namespaced under .poker-root
   so it cannot leak into the rest of the portal.
   =================================================================== */

.poker-root {
  --pk-cw: 62px;              /* card width; every card metric derives from it */
  --pk-felt: #1f5e3e;
  --pk-rail: #6b4a2c;
  --pk-red: #c8102e;
  --pk-black: #14161a;
  margin-top: 28px;
  font-family: var(--font-body);
  color: var(--text);
}

/* ---------- top bar ---------- */
.pk-topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-radius: 10px 10px 0 0;
  background: linear-gradient(135deg, var(--navy-deep), var(--navy-light));
  color: var(--white);
}

.pk-brand {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.pk-brand-suit { color: var(--gold); }

.pk-wallet {
  margin-left: auto;
  font-size: 0.9rem;
  letter-spacing: 0.03em;
}

.pk-wallet strong {
  color: var(--gold-light);
  font-size: 1.05rem;
}

/* ---------- shared bits ---------- */
.pk-panel {
  background: var(--white);
  border: 1px solid #ebebeb;
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(15, 27, 45, 0.06);
  padding: 20px;
  margin-bottom: 18px;
}

.pk-panel h4 {
  font-family: var(--font-display);
  color: var(--navy);
  font-size: 1.25rem;
  margin-bottom: 10px;
}

.pk-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 12px;
}

.pk-empty {
  font-size: 0.84rem;
  color: var(--text-muted);
  padding: 10px 0;
}

.pk-warn {
  color: #b3401f;
  font-weight: 600;
}

.pk-btn {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.16s ease, box-shadow 0.16s ease;
  background: var(--navy);
  color: var(--white);
}

.pk-btn:hover:not(:disabled) { transform: translateY(-1px); }
.pk-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.pk-btn-gold { background: var(--gold); color: var(--navy-deep); }
.pk-btn-gold:hover:not(:disabled) { background: var(--gold-light); }

.pk-btn-ghost {
  background: transparent;
  border-color: rgba(25, 42, 69, 0.25);
  color: var(--navy);
}
.pk-btn-ghost:hover:not(:disabled) { border-color: var(--navy); }

.pk-topbar .pk-btn-ghost {
  border-color: rgba(255, 255, 255, 0.35);
  color: var(--white);
}

.pk-btn-warn { background: #b3401f; color: #fff; }
.pk-btn-fold { background: #6b6b6b; }
.pk-btn-check { background: #2e7d54; }
.pk-btn-call { background: #2e7d54; }
.pk-btn-raise { background: var(--gold); color: var(--navy-deep); }
.pk-btn-mini {
  padding: 7px 11px;
  font-size: 0.68rem;
  background: transparent;
  border-color: rgba(25, 42, 69, 0.25);
  color: var(--navy);
}

.pk-chip-tag {
  display: inline-block;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 20px;
  background: var(--gold-pale);
  color: var(--navy);
  vertical-align: middle;
}

/* ---------- lobby ---------- */
.pk-lobby { padding-top: 18px; }

.pk-create-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.pk-create-grid label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.pk-create-grid input,
.pk-create-grid select {
  padding: 9px 11px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 0.88rem;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text);
}

.pk-lobby-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 0;
  border-top: 1px solid #f0f0f0;
}

.pk-lobby-main { flex: 1; min-width: 210px; display: flex; flex-direction: column; gap: 3px; }

.pk-lobby-name {
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 600;
  color: var(--navy);
}

.pk-lobby-meta { font-size: 0.76rem; color: var(--text-muted); }

.pk-lobby-stat { text-align: center; min-width: 62px; }
.pk-lobby-stat strong { display: block; font-size: 0.95rem; color: var(--navy); }
.pk-lobby-stat span {
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ---------- table header ---------- */
.pk-tableview { padding-top: 18px; }

.pk-table-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.pk-table-head h4 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--navy);
}

.pk-table-meta { font-size: 0.76rem; color: var(--text-muted); }
.pk-table-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- the felt ---------- */
.pk-felt-wrap {
  padding: 54px 30px 62px;
  border-radius: 12px;
  background: linear-gradient(160deg, #12213a, #0b1523);
  overflow: hidden;
}

.pk-felt {
  position: relative;
  width: 100%;
  max-width: 820px;
  aspect-ratio: 8 / 5;
  margin: 0 auto;
  border-radius: 46% / 50%;
  background:
    radial-gradient(ellipse at 50% 40%, #2f8358 0%, var(--pk-felt) 52%, #143c28 100%);
  border: 15px solid var(--pk-rail);
  box-shadow:
    inset 0 0 70px rgba(0, 0, 0, 0.45),
    0 20px 50px rgba(0, 0, 0, 0.4);
}

/* The thin gold line that runs just inside the rail on a real table. */
.pk-felt-rail {
  position: absolute;
  inset: 12px;
  border-radius: 46% / 50%;
  border: 1px solid rgba(201, 168, 76, 0.35);
  pointer-events: none;
}

/* ---------- board + pot ---------- */
.pk-board {
  position: absolute;
  left: 50%;
  top: 47%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: max-content;
}

.pk-pot {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 5px 16px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(201, 168, 76, 0.4);
}

.pk-pot span {
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-pale);
}

.pk-pot strong {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--white);
}

.pk-community { display: flex; gap: 7px; }

.pk-phase {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.82);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  max-width: 320px;
  text-align: center;
  line-height: 1.5;
}

/* ---------- seats ---------- */
.pk-seat {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 132px;
}

.pk-seat[data-pos="0"] { left: 50%; top: 96%; }
.pk-seat[data-pos="1"] { left: 10%; top: 74%; }
.pk-seat[data-pos="2"] { left: 5%;  top: 26%; }
.pk-seat[data-pos="3"] { left: 50%; top: 4%; }
.pk-seat[data-pos="4"] { left: 95%; top: 26%; }
.pk-seat[data-pos="5"] { left: 90%; top: 74%; }

.pk-plate {
  width: 100%;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(10, 20, 34, 0.88);
  border: 1px solid rgba(201, 168, 76, 0.28);
  color: var(--white);
  text-align: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.pk-plate-name {
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pk-plate-stack {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--gold-light);
  line-height: 1.2;
}

.pk-plate-flag {
  font-size: 0.6rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
}

.pk-flag-allin { color: #ff8b6b; }

.pk-dealer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--white);
  color: var(--navy-deep);
  font-size: 0.6rem;
  font-weight: 700;
  vertical-align: middle;
}

.pk-seat-acting .pk-plate {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(201, 168, 76, 0.5), 0 0 22px rgba(201, 168, 76, 0.45);
  animation: pkPulse 1.8s ease-in-out infinite;
}

@keyframes pkPulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(201, 168, 76, 0.5), 0 0 18px rgba(201, 168, 76, 0.35); }
  50%      { box-shadow: 0 0 0 2px rgba(201, 168, 76, 0.9), 0 0 30px rgba(201, 168, 76, 0.6); }
}

.pk-seat-folded { opacity: 0.55; }
.pk-seat-out .pk-plate { border-style: dashed; }
.pk-seat-hero .pk-plate { border-color: var(--gold-light); background: rgba(25, 42, 69, 0.95); }

.pk-seat-empty {
  width: 112px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pk-seat-open {
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  border: 1px dashed rgba(255, 255, 255, 0.3);
  border-radius: 30px;
  padding: 8px 14px;
}

.pk-sit-btn {
  font-family: var(--font-body);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 9px 15px;
  border-radius: 30px;
  border: 1px solid var(--gold);
  background: rgba(201, 168, 76, 0.14);
  color: var(--gold-pale);
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.pk-sit-btn:hover { background: var(--gold); color: var(--navy-deep); }

.pk-hole { display: flex; gap: 4px; }

/* Turn clock: drains left to right under the acting player's plate. */
.pk-timer {
  width: 100%;
  height: 4px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.pk-timer-fill {
  height: 100%;
  width: 100%;
  background: var(--gold);
  transition: width 0.4s linear;
}

.pk-timer-fill.pk-timer-low { background: #d8563a; }

.pk-bet {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--white);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

.pk-bet-chip {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: repeating-conic-gradient(var(--gold) 0 25%, #8c6a1f 0 50%);
  border: 2px solid #fff6dd;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.45);
}

.pk-win-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 12px;
  border-radius: 20px;
  background: var(--gold);
  color: var(--navy-deep);
  font-size: 0.82rem;
  font-weight: 700;
  animation: pkPop 0.45s cubic-bezier(0.18, 1.3, 0.4, 1) backwards;
}

.pk-win-badge span {
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.8;
}

@keyframes pkPop {
  from { opacity: 0; transform: scale(0.5) translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.pk-seat-winner .pk-plate {
  border-color: var(--gold);
  box-shadow: 0 0 26px rgba(201, 168, 76, 0.6);
}

/* ===================================================================
   PLAYING CARDS
   A card is always a flipper so it can turn over in place at showdown.
   =================================================================== */
.pk-card {
  position: relative;
  width: var(--pk-cw);
  height: calc(var(--pk-cw) * 1.4);
  perspective: 800px;
  flex: none;
}

.pk-card-sm { --pk-cw: 46px; }

.pk-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transform: rotateY(180deg);
  transition: transform 0.55s cubic-bezier(0.4, 0.1, 0.2, 1);
}

.pk-card-up .pk-card-inner { transform: rotateY(0deg); }

.pk-card-back,
.pk-card-face {
  position: absolute;
  inset: 0;
  border-radius: calc(var(--pk-cw) * 0.09);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
}

.pk-card-face {
  background: linear-gradient(160deg, #ffffff, #f4f1ea);
  border: 1px solid rgba(0, 0, 0, 0.18);
  color: var(--pk-black);
  overflow: hidden;
}

.pk-card-face[data-suit="h"],
.pk-card-face[data-suit="d"] { color: var(--pk-red); }

/* Classic navy-and-gold lattice back. */
.pk-card-back {
  transform: rotateY(180deg);
  border: 1px solid rgba(0, 0, 0, 0.25);
  background:
    repeating-linear-gradient(45deg, rgba(201, 168, 76, 0.5) 0 2px, transparent 2px 6px),
    repeating-linear-gradient(-45deg, rgba(201, 168, 76, 0.5) 0 2px, transparent 2px 6px),
    linear-gradient(150deg, #24405f, #16283f);
  background-clip: padding-box;
}

.pk-card-back::after {
  content: "";
  position: absolute;
  inset: 12%;
  border: 1px solid rgba(240, 225, 181, 0.55);
  border-radius: 3px;
}

.pk-idx {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 0.95;
  font-weight: 700;
}

.pk-idx-tl { top: 4%; left: 6.5%; }
.pk-idx-br { bottom: 4%; right: 6.5%; transform: rotate(180deg); }

.pk-idx em {
  font-style: normal;
  font-size: calc(var(--pk-cw) * 0.23);
  letter-spacing: -0.03em;
}

.pk-idx i {
  font-style: normal;
  font-size: calc(var(--pk-cw) * 0.175);
}

/* 3 x 7 grid: one cell per pip position on a real card face. Pips are sized
   to the row height so the rows below the middle never collide. */
.pk-pips {
  position: absolute;
  inset: 13% 27%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(7, 1fr);
}

.pk-pip {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--pk-cw) * 0.17);
  line-height: 1;
}

.pk-pip-inv { transform: rotate(180deg); }
.pk-pip-big { font-size: calc(var(--pk-cw) * 0.5); }

.pk-court {
  position: absolute;
  inset: 15% 26%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 1px solid currentColor;
  border-radius: 3px;
  background:
    repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.045) 0 3px, transparent 3px 7px);
}

.pk-court-letter {
  font-family: var(--font-display);
  font-size: calc(var(--pk-cw) * 0.48);
  font-weight: 700;
  line-height: 1;
}

.pk-court-suit { font-size: calc(var(--pk-cw) * 0.24); line-height: 1; }

.pk-court-name {
  font-size: calc(var(--pk-cw) * 0.11);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.65;
}

.pk-card-slot {
  border: 1px dashed rgba(255, 255, 255, 0.22);
  border-radius: calc(var(--pk-cw) * 0.09);
  background: rgba(0, 0, 0, 0.1);
}

.pk-card-slot .pk-card-inner { display: none; }

.pk-card-win .pk-card-face {
  box-shadow: 0 0 0 2px var(--gold), 0 0 20px rgba(201, 168, 76, 0.75);
}

.pk-card-dim { opacity: 0.4; filter: grayscale(0.5); }

/* Cards arrive from the middle of the table, angled the way they were pitched. */
@keyframes pkDeal {
  from {
    opacity: 0;
    transform: translate(var(--pk-fx, 0), var(--pk-fy, -150px)) rotate(-14deg) scale(0.82);
  }
  to { opacity: 1; transform: none; }
}

.pk-card-deal { animation: pkDeal 0.42s cubic-bezier(0.2, 0.9, 0.25, 1) backwards; }

.pk-seat[data-pos="0"] .pk-card-deal { --pk-fx: 0px;    --pk-fy: -150px; }
.pk-seat[data-pos="1"] .pk-card-deal { --pk-fx: 140px;  --pk-fy: -80px; }
.pk-seat[data-pos="2"] .pk-card-deal { --pk-fx: 155px;  --pk-fy: 55px; }
.pk-seat[data-pos="3"] .pk-card-deal { --pk-fx: 0px;    --pk-fy: 150px; }
.pk-seat[data-pos="4"] .pk-card-deal { --pk-fx: -155px; --pk-fy: 55px; }
.pk-seat[data-pos="5"] .pk-card-deal { --pk-fx: -140px; --pk-fy: -80px; }

/* ---------- action bar ---------- */
.pk-actionbar {
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: 10px;
  background: var(--white);
  border: 1px solid #ebebeb;
  box-shadow: 0 8px 28px rgba(15, 27, 45, 0.06);
}

.pk-actionbar-idle { text-align: center; }
.pk-actionbar-idle .pk-note { margin: 0; }

.pk-act-row { display: flex; gap: 10px; flex-wrap: wrap; }

.pk-act-row .pk-btn { min-width: 120px; }

.pk-act-waiting {
  font-size: 0.84rem;
  color: var(--text-muted);
  font-style: italic;
}

.pk-raise-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.pk-raise-row input[type="range"] { flex: 1; min-width: 160px; accent-color: var(--gold); }

.pk-raise-row input[type="number"] {
  width: 96px;
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 0.88rem;
}

.pk-act-secondary {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #f0f0f0;
}

.pk-my-stack {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-right: auto;
}

.pk-my-stack strong { color: var(--navy); font-size: 0.95rem; }

/* ---------- log ---------- */
.pk-logpanel { margin-top: 18px; }

.pk-log {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 210px;
  overflow-y: auto;
  font-size: 0.8rem;
}

.pk-log li {
  padding: 6px 0;
  border-bottom: 1px solid #f4f4f4;
  color: var(--text-muted);
}

.pk-log li:first-child { color: var(--navy); font-weight: 500; }

/* ---------- modal ---------- */
.pk-modal {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(10, 18, 30, 0.62);
  backdrop-filter: blur(2px);
}

.pk-modal-card {
  width: 100%;
  max-width: 400px;
  background: var(--white);
  border-radius: 10px;
  padding: 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.pk-modal-card h4 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--navy);
  margin-bottom: 8px;
}

.pk-modal-input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 1rem;
}

.pk-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .poker-root { --pk-cw: 50px; }
  .pk-card-sm { --pk-cw: 38px; }
  .pk-felt-wrap { padding: 44px 14px 52px; }
  .pk-seat { width: 108px; }
  .pk-seat[data-pos="1"], .pk-seat[data-pos="5"] { top: 76%; }
}

@media (max-width: 640px) {
  .poker-root { --pk-cw: 40px; }
  .pk-card-sm { --pk-cw: 31px; }
  .pk-felt { aspect-ratio: 7 / 6; border-width: 10px; }
  .pk-felt-wrap { padding: 40px 8px 46px; }
  .pk-seat { width: 88px; }
  .pk-seat-empty { width: 84px; }
  .pk-plate-name { font-size: 0.68rem; }
  .pk-plate-stack { font-size: 0.92rem; }
  .pk-seat[data-pos="1"] { left: 12%; top: 72%; }
  .pk-seat[data-pos="2"] { left: 9%;  top: 27%; }
  .pk-seat[data-pos="4"] { left: 91%; top: 27%; }
  .pk-seat[data-pos="5"] { left: 88%; top: 72%; }
  .pk-act-row .pk-btn { flex: 1; min-width: 0; }
  .pk-community { gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  .pk-card-deal,
  .pk-win-badge { animation: none; }
  .pk-card-inner { transition: none; }
  .pk-seat-acting .pk-plate { animation: none; }
}
