:root {
  --bg0: #0b1524;
  --bg1: #10263f;
  --bg2: #153a5e;
  --panel: rgba(9, 21, 36, 0.84);
  --line: rgba(150, 191, 232, 0.28);
  --text: #e8f2ff;
  --muted: #9fb7d3;
  --accent: #2c7be5;
  --accent-strong: #1f63c4;
  --danger: #d84d61;
  --good: #4fcd8a;
  --felt1: #165b75;
  --felt2: #0f3f56;
  --seat: rgba(8, 18, 31, 0.82);
  --card-light: #f7fbff;
  --card-dark: #eef4fb;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
  color: var(--text);
  background:
    radial-gradient(980px 620px at 100% -20%, rgba(79, 205, 138, 0.17), transparent 60%),
    linear-gradient(160deg, var(--bg2), var(--bg1) 48%, var(--bg0));
}

.app {
  max-width: 1320px;
  margin: 0 auto;
  padding: 22px 14px 26px;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}

h1,h2,h3 { margin: 0; font-family: 'Sora', sans-serif; }
h1 { font-size: clamp(1.8rem, 3vw, 2.55rem); }

.sub { margin: 4px 0 0; color: var(--muted); }

.back {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  padding-top: 6px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  backdrop-filter: blur(6px);
}

.hidden { display: none !important; }

.setup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.setup-form {
  border: 1px solid rgba(159, 183, 211, 0.24);
  background: rgba(8, 19, 33, 0.56);
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 8px;
}

input, button {
  border-radius: 10px;
  border: 1px solid rgba(181, 206, 232, 0.34);
  padding: 10px;
  font-size: 0.94rem;
}

input {
  background: rgba(244, 248, 255, 0.95);
  color: #10253f;
}

button {
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

button.ghost {
  background: rgba(245, 251, 255, 0.95);
  color: #22466f;
  border-color: rgba(181, 206, 232, 0.7);
}

button.danger {
  background: linear-gradient(180deg, #f39aaa, #d84d61);
  border-color: #d84d61;
  color: #3a0f18;
}

button:disabled { opacity: 0.6; cursor: not-allowed; }

.status {
  margin: 10px 0 0;
  color: var(--muted);
  min-height: 1.2rem;
}

.table-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 12px;
}

.table-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.phase { margin: 5px 0 0; color: var(--muted); }

.pill-row { display: flex; gap: 8px; }

.pill {
  border-radius: 999px;
  padding: 6px 11px;
  border: 1px solid rgba(191, 220, 255, 0.35);
  background: rgba(8, 18, 31, 0.56);
  font-size: 0.84rem;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.pill.bump {
  transform: scale(1.06);
  box-shadow: 0 0 0 2px rgba(255, 222, 137, 0.35);
}

.pill.muted { color: var(--muted); }

.felt {
  margin-top: 10px;
  border-radius: 28px;
  border: 1px solid rgba(152, 198, 235, 0.2);
  background: radial-gradient(circle at 50% 35%, var(--felt1), var(--felt2));
  box-shadow: inset 0 0 0 2px rgba(9, 29, 45, 0.45), 0 14px 30px rgba(4, 12, 21, 0.26);
  padding: 14px;
}

.felt-inner {
  position: relative;
  min-height: 560px;
  border-radius: 999px;
  border: 2px solid rgba(207, 227, 255, 0.15);
  overflow: hidden;
}

.felt-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(76%, 520px);
  min-height: 120px;
  border-radius: 28px;
  border: 1px solid rgba(207, 227, 255, 0.18);
  background: rgba(8, 24, 39, 0.34);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px;
}

.center-pot {
  border-radius: 999px;
  border: 1px solid rgba(228, 250, 237, 0.45);
  background: linear-gradient(180deg, rgba(19, 93, 61, 0.88), rgba(10, 63, 41, 0.88));
  color: #eafff2;
  font-weight: 800;
  letter-spacing: 0.06em;
  font-size: 0.74rem;
  padding: 5px 14px;
  box-shadow: inset 0 0 0 1px rgba(120, 218, 170, 0.34), 0 8px 18px rgba(2, 16, 11, 0.34);
}

.center-pot.pulse {
  animation: potPulse 340ms ease;
}

@keyframes potPulse {
  0% { transform: scale(0.92); }
  60% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.table-seats {
  position: absolute;
  inset: 0;
  list-style: none;
  margin: 0;
  padding: 0;
}

.seat {
  position: absolute;
  width: 196px;
  min-height: 102px;
  padding: 7px;
  border-radius: 18px;
  border: 1px solid rgba(167, 199, 230, 0.22);
  background: linear-gradient(180deg, rgba(8, 18, 31, 0.72), rgba(7, 15, 25, 0.78));
  box-shadow: 0 14px 20px rgba(3, 9, 17, 0.28);
  font-size: 0.84rem;
  opacity: 0;
  animation: seatFadeIn 250ms ease forwards;
}

@keyframes seatFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.seat.turn {
  border-color: rgba(107, 217, 156, 0.85);
  box-shadow: 0 0 0 1px rgba(79, 205, 138, 0.3) inset, 0 0 18px rgba(79, 205, 138, 0.25);
}

.seat.folded { opacity: 0.58; }
.seat.folded .avatar-chip-ring { filter: grayscale(0.8); opacity: 0.45; }

.seat-shell {
  border-radius: 12px;
  border: 1px solid rgba(140, 181, 220, 0.2);
  background:
    radial-gradient(90px 60px at 20% -30%, rgba(124, 169, 211, 0.14), transparent 70%),
    linear-gradient(180deg, rgba(13, 25, 40, 0.92), rgba(8, 18, 31, 0.92));
  padding: 8px 9px;
}

.seat-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.avatar-wrap {
  position: relative;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.avatar-chip-ring {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: conic-gradient(from 210deg, #f5cb71, #cc9e41, #f8dc9a, #c58f2c, #f5cb71);
  box-shadow: 0 0 0 1px rgba(102, 71, 25, 0.55), 0 0 9px rgba(248, 220, 154, 0.32);
  animation: ringPulse 1.8s ease-in-out infinite;
}

@keyframes ringPulse {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.04); filter: brightness(1.1); }
}

.avatar {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 0.76rem;
  font-weight: 700;
  background: linear-gradient(180deg, #2e669f, #1f436a);
  color: #e7f2ff;
  border: 1px solid rgba(191, 220, 255, 0.36);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.avatar-status {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 11px;
  height: 11px;
  border-radius: 999px;
  border: 2px solid rgba(8, 18, 31, 0.95);
  box-shadow: 0 0 0 1px rgba(224, 241, 255, 0.24);
}

.avatar-status.idle { background: #6f879f; }
.avatar-status.turn { background: #47d487; box-shadow: 0 0 0 1px rgba(224, 241, 255, 0.24), 0 0 8px rgba(71, 212, 135, 0.52); }
.avatar-status.fold { background: #d0586b; }

.seat.turn .avatar-chip-ring {
  box-shadow: 0 0 0 1px rgba(102, 71, 25, 0.55), 0 0 15px rgba(79, 205, 138, 0.44);
}

.seat-name {
  font-weight: 700;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 6px;
}

.seat-name strong {
  font-size: 0.89rem;
  letter-spacing: 0.01em;
}

.seat-no {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8da4bf;
  border: 1px solid rgba(121, 152, 183, 0.35);
  border-radius: 999px;
  padding: 1px 6px;
}

.seat-meta {
  color: var(--muted);
  margin-top: 7px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.seat-meta span {
  border-radius: 8px;
  border: 1px solid rgba(129, 165, 200, 0.28);
  background: rgba(9, 20, 33, 0.68);
  padding: 4px 6px;
  font-size: 0.67rem;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta-stack { color: #dbe9f7; }
.meta-bet { color: #b8d8ff; }
.meta-action { color: #9fc2e7; }

.seat.turn .meta-action {
  color: #90f0be;
  border-color: rgba(79, 205, 138, 0.44);
}

.seat-role-buttons {
  position: absolute;
  top: -9px;
  right: -10px;
  display: flex;
  gap: 4px;
}

.seat-button {
  min-width: 25px;
  height: 22px;
  border-radius: 999px;
  padding: 0 7px;
  display: grid;
  place-items: center;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #12263c;
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 4px 9px rgba(3, 9, 17, 0.35);
}

.seat-button.dealer {
  background: linear-gradient(180deg, #fff4ca, #edd283);
}

.seat-button.sb {
  background: linear-gradient(180deg, #d3f7f0, #91dfcc);
}

.seat-button.bb {
  background: linear-gradient(180deg, #d2e8ff, #8bb9f0);
}

.seat.south { left: 50%; bottom: 10px; transform: translateX(-50%); }
.seat.southwest { left: 14%; bottom: 16%; }
.seat.west { left: 4%; top: 50%; transform: translateY(-50%); }
.seat.northwest { left: 14%; top: 16%; }
.seat.north { left: 50%; top: 10px; transform: translateX(-50%); }
.seat.northeast { right: 14%; top: 16%; }
.seat.east { right: 4%; top: 50%; transform: translateY(-50%); }
.seat.southeast { right: 14%; bottom: 16%; }

.cards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.card {
  width: 58px;
  height: 78px;
  border-radius: 10px;
  border: 1px solid #cfdae8;
  background: linear-gradient(180deg, var(--card-light), var(--card-dark));
  color: #0f2138;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 6px;
  font-weight: 700;
  box-shadow: 0 5px 12px rgba(4, 12, 21, 0.22);
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  animation: dealIn 220ms ease forwards;
}

@keyframes dealIn {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.card.red { color: #b72230; }
.card.back { background: linear-gradient(150deg, #1e4470, #132c4b); border-color: #2b5a8f; color: #d7e9ff; }
.card.empty { opacity: 0.3; animation: none; transform: none; }

.chip-fx {
  pointer-events: none;
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.chip-fx .chip {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: radial-gradient(circle at 35% 35%, #f8e58e, #d6a63a);
  box-shadow: 0 0 0 1px rgba(65, 47, 13, 0.4);
  left: var(--x, 50%);
  top: var(--y, 50%);
  animation: chipFly 500ms ease forwards;
}

@keyframes chipFly {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.1); }
}

.table-motion-fx {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

.motion-chip,
.motion-card {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  animation: motionTravel var(--dur, 520ms) cubic-bezier(0.2, 0.65, 0.22, 1) forwards;
}

.motion-chip {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: radial-gradient(circle at 35% 35%, #f8e58e, #d6a63a);
  border: 1px solid rgba(84, 56, 18, 0.64);
  box-shadow: 0 0 0 2px rgba(245, 206, 118, 0.33);
}

.motion-card {
  width: 22px;
  height: 30px;
  border-radius: 6px;
  background: linear-gradient(150deg, #1e4470, #132c4b);
  border: 1px solid #2b5a8f;
  box-shadow: 0 4px 10px rgba(4, 12, 21, 0.45);
}

.motion-card.fold-card {
  background: linear-gradient(160deg, #6f2834, #2f1722);
  border-color: #a03a4c;
  box-shadow: 0 4px 10px rgba(38, 5, 11, 0.55);
}

@keyframes motionTravel {
  0% {
    opacity: 0;
    left: var(--sx);
    top: var(--sy);
    transform: translate(-50%, -50%) scale(0.5) rotate(-14deg);
  }
  15% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    left: var(--tx);
    top: var(--ty);
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
  }
}

.deck-anchor {
  position: absolute;
  width: 24px;
  height: 34px;
  border-radius: 7px;
  border: 1px solid rgba(171, 211, 252, 0.6);
  background: linear-gradient(155deg, #204a78, #163659);
  box-shadow: 0 5px 10px rgba(4, 12, 21, 0.36);
  right: 12px;
  top: 10px;
  opacity: 0.62;
}

.muck-anchor {
  position: absolute;
  width: 40px;
  height: 30px;
  border-radius: 8px;
  left: 12px;
  top: 50%;
  transform: translateY(-50%) rotate(-16deg);
  border: 1px dashed rgba(255, 191, 204, 0.35);
  background: rgba(42, 14, 23, 0.24);
}

.tag {
  font-size: 0.63rem;
  border-radius: 999px;
  padding: 1px 5px;
  border: 1px solid rgba(129, 174, 222, 0.55);
  color: #cfe4ff;
}

.tag.turn { border-color: rgba(79, 205, 138, 0.9); color: #89f1bc; }
.tag.fold { border-color: rgba(216, 77, 97, 0.8); color: #ffb8c2; }
.tag.allin { border-color: rgba(255, 210, 95, 0.9); color: #ffe3a5; }

.your-hand-wrap { margin-top: 12px; }

.side {
  display: grid;
  gap: 12px;
  align-content: start;
}

.share {
  padding: 10px;
  border-radius: 12px;
  background: rgba(7, 18, 31, 0.58);
  border: 1px solid rgba(159, 183, 211, 0.22);
}

.share label {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.share-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.share-actions {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.share-qr-wrap {
  margin-top: 10px;
  display: grid;
  place-items: center;
  padding: 8px;
  border-radius: 10px;
  background: rgba(7, 14, 25, 0.6);
  border: 1px solid rgba(159, 183, 211, 0.2);
}

.share-qr {
  width: 164px;
  height: 164px;
  border-radius: 8px;
  border: 1px solid rgba(170, 201, 232, 0.44);
  background: #fff;
}

.host-actions,
.action-panel {
  display: grid;
  gap: 8px;
}

.action-panel {
  background: linear-gradient(180deg, rgba(10, 14, 18, 0.95), rgba(7, 10, 14, 0.95));
  border: 1px solid rgba(110, 136, 161, 0.3);
  border-radius: 12px;
  padding: 10px;
}

.action-panel h3 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #9cb2c8;
}

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.raise-row {
  display: block;
}

.action-btn {
  background: rgba(9, 14, 9, 0.72);
  border: 1px solid rgba(97, 209, 127, 0.8);
  color: #93ffb2;
  border-radius: 8px;
  min-height: 42px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.77rem;
  box-shadow: inset 0 0 0 1px rgba(26, 53, 33, 0.92), 0 0 12px rgba(28, 148, 60, 0.16);
}

.action-btn:hover {
  box-shadow: inset 0 0 0 1px rgba(26, 53, 33, 0.92), 0 0 16px rgba(46, 179, 83, 0.34);
}

.action-btn.raise {
  border-color: rgba(121, 215, 255, 0.8);
  color: #b9e8ff;
  box-shadow: inset 0 0 0 1px rgba(21, 45, 62, 0.92), 0 0 12px rgba(56, 143, 193, 0.2);
}

.action-btn.allin {
  border-color: rgba(246, 195, 95, 0.85);
  color: #ffe39e;
  box-shadow: inset 0 0 0 1px rgba(63, 48, 15, 0.92), 0 0 12px rgba(203, 158, 46, 0.2);
}

.action-btn.fold {
  border-color: rgba(244, 92, 104, 0.9);
  color: #ffb8c0;
  box-shadow: inset 0 0 0 1px rgba(68, 20, 28, 0.92), 0 0 12px rgba(192, 56, 69, 0.24);
}

.action-btn.call {
  border-color: rgba(97, 209, 127, 0.95);
  color: #9cffb9;
}

.action-btn.check {
  border-color: rgba(199, 209, 224, 0.74);
  color: #dbe5f5;
}

#raiseInput {
  width: 100%;
  background: rgba(6, 11, 15, 0.95);
  border-color: rgba(99, 124, 151, 0.45);
  color: #d8e8fb;
  text-align: center;
  font-weight: 700;
}

#raiseInput::placeholder {
  color: #7f97b2;
}

.legend {
  margin: 8px 0 0;
  padding-left: 0;
  list-style: none;
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.dot {
  width: 9px;
  height: 9px;
  display: inline-block;
  border-radius: 999px;
  margin-right: 8px;
}

.dot.turn { background: var(--good); }
.dot.fold { background: var(--danger); }
.dot.allin { background: #f2ca57; }

@media (max-width: 980px) {
  .table-view { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .setup-grid { grid-template-columns: 1fr; }

  .table-head,
  .pill-row { flex-direction: column; align-items: stretch; }

  .felt-inner {
    min-height: 520px;
    border-radius: 24px;
  }

  .seat {
    position: static;
    width: 100%;
    margin-bottom: 8px;
    transform: none !important;
    animation: none;
    opacity: 1;
  }

  .seat-role-buttons {
    position: static;
    margin-bottom: 6px;
  }

  .table-seats {
    position: static;
    padding: 10px;
  }

  .felt-center {
    position: static;
    transform: none;
    width: 100%;
    margin-bottom: 8px;
  }

  .table-motion-fx,
  .deck-anchor {
    display: none;
  }

  .share-row,
  .share-actions,
  .raise-row,
  .action-grid { grid-template-columns: 1fr; }
}
