:root {
  --bg: #070b09;
  --felt: #0b3d2e;
  --felt-deep: #06261d;
  --rail: #3b2414;
  --gold: #e2c078;
  --gold-dim: #a8843c;
  --ink: #f4efe4;
  --mute: #b7b09f;
  --red: #c73b3b;
  --danger: #8d2a2a;
  --glass: rgba(10, 16, 13, 0.72);
  --line: rgba(226, 192, 120, 0.22);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  background: radial-gradient(circle at 50% -10%, #163226 0%, var(--bg) 52%);
  color: var(--ink);
  font-family: Manrope, sans-serif;
}

html.admin-page,
body.admin-page {
  height: auto;
  min-height: 100dvh;
  overflow: auto;
  overflow-x: hidden;
  overscroll-behavior: auto;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

body {
  display: flex;
  flex-direction: column;
}

body.admin-page {
  display: block;
}

body.admin-page .top {
  display: flex;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(180deg, #070b09 70%, rgba(7, 11, 9, 0.88));
}

body.admin-page .panel {
  width: calc(100% - 24px);
  max-width: none;
  min-height: 0;
  margin: 0 12px 28px;
  padding-bottom: 28px;
  border-radius: 20px;
}

body.admin-page .table-card {
  flex-direction: column;
  align-items: stretch;
}

body.admin-page .account-actions {
  justify-content: flex-start;
}

body.admin-page .pay-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

body.admin-page .pay-row .btn {
  min-height: 40px;
  padding: 8px 12px;
}

.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.09;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.8' /%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  flex: 0 0 auto;
  padding: 10px 14px 8px;
  padding-top: max(10px, env(safe-area-inset-top));
}


.table-pot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--gold);
  font-size: 18px;
  flex: 0 1 auto;
}

.table-pot b {
  color: var(--gold);
  font-size: 20px;
}

.ico {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.link .ico {
  margin-right: 4px;
  vertical-align: -3px;
}

.brand {
  display: flex;
  gap: 8px;
  align-items: baseline;
  min-width: 0;
  flex: 1 1 auto;
}

.mode-label {
  font-style: normal;
  color: var(--mute);
  font-size: 13px;
  white-space: nowrap;
}

.brand strong {
  display: block;
  font-family: "Cormorant Garamond", serif;
  font-size: 28px;
  letter-spacing: 0.04em;
}

.pulse {
  animation: pulse 2.4s ease-in-out infinite;
}

.diamond {
  color: var(--gold);
  font-size: 30px;
}

.top-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-left: auto;
  flex: 0 0 auto;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 16px;
  color: var(--mute);
}

.check input {
  width: 18px;
  height: 18px;
}

.wallet {
  text-align: right;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 6px 12px;
}

.wallet span {
  display: block;
  color: var(--mute);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.wallet b {
  color: var(--gold);
  font-size: 18px;
}

.panel {
  width: min(560px, calc(100% - 32px));
  margin: 18px auto 40px;
  padding: 28px;
  background: linear-gradient(180deg, rgba(20, 28, 23, 0.92), rgba(8, 12, 10, 0.9));
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

h1,
h2 {
  font-family: "Cormorant Garamond", serif;
  margin: 0 0 8px;
}

h1 {
  font-size: 42px;
}

.lead,
.rules-body,
.share {
  color: var(--mute);
  line-height: 1.5;
}

.share {
  background: #0c1210;
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  word-break: break-all;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 14px 0;
  color: var(--mute);
  font-size: 13px;
}

input {
  border: 1px solid var(--line);
  background: #0c1210;
  color: var(--ink);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
}

.row {
  display: flex;
  gap: 12px;
}

.grow {
  flex: 1;
}

.actions,
.join-row,
.hud-meta,
.controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.join-row {
  margin-top: 12px;
}

.join-row input {
  flex: 1;
}

.btn,
.link {
  border: 0;
  cursor: pointer;
  font: inherit;
}

.btn {
  border-radius: 14px;
  padding: 12px 16px;
  background: #1b2420;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn.gold {
  background: linear-gradient(180deg, #f0d392, #c49a45);
  color: #2a1c08;
  border-color: transparent;
  font-weight: 700;
}

.btn.ghost {
  background: transparent;
}

.btn.danger {
  background: var(--danger);
  border-color: transparent;
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.btn,
.menu-btn {
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.btn:hover,
.menu-btn:hover {
  transform: translateY(-2px);
}

.menu {
  display: grid;
  gap: 12px;
}

.menu-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  border: 1px solid var(--line);
  background: #121a16;
  color: var(--ink);
  border-radius: 18px;
  padding: 18px 20px;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.menu-btn span {
  font-family: "Cormorant Garamond", serif;
  font-size: 28px;
}

.menu-btn small {
  color: var(--mute);
}

.menu-btn.gold {
  background: linear-gradient(180deg, #f0d392, #c49a45);
  color: #2a1c08;
  border-color: transparent;
}

.menu-btn.gold small {
  color: #5a3d12;
}

.menu-btn.ghost {
  background: transparent;
}

.code-box {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.code-box input {
  flex: 1;
}

.fade-up {
  animation: fadeUp 0.45s ease;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.55;
    transform: scale(1.08);
  }
}

@keyframes dealIn {
  0% {
    opacity: 0;
    transform: translateY(-130px) scale(0.28) rotate(-22deg);
  }
  62% {
    opacity: 1;
    transform: translateY(10px) scale(1.06) rotate(4deg);
  }
  100% {
    opacity: 1;
    transform: none;
  }
}

@keyframes boardDeal {
  0% {
    opacity: 0;
    transform: translateY(-80px) scale(0.45) rotateY(80deg);
  }
  68% {
    opacity: 1;
    transform: translateY(8px) scale(1.05) rotateY(0deg);
  }
  100% {
    opacity: 1;
    transform: none;
  }
}

@keyframes muckOut {
  to {
    opacity: 0.2;
    transform: translateY(18px) rotate(12deg) scale(0.85);
  }
}

.card.deal {
  animation: dealIn 0.95s cubic-bezier(0.22, 0.72, 0.28, 1) both;
}

.card.deal-1 {
  animation-delay: 0.06s;
}

.card.deal-2 {
  animation-delay: 0.4s;
}

.card.board-deal {
  animation: boardDeal 0.75s cubic-bezier(0.22, 0.7, 0.3, 1) both;
}

.card.muck {
  animation: muckOut 0.4s ease both;
}

.link {
  background: none;
  color: var(--gold);
}

.open-tables {
  margin-top: 26px;
}

.table-list {
  display: grid;
  gap: 8px;
}

.table-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #0d1411;
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.felt {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 4px 10px 8px;
  overflow: hidden;
}

.rail {
  position: relative;
  width: min(980px, 100%);
  flex: 1;
  min-height: 240px;
  margin: 0 auto;
  background: radial-gradient(circle at 30% 20%, #6a4324, var(--rail) 55%);
  border-radius: 999px;
  box-shadow: inset 0 0 0 6px #2a180d, 0 20px 50px rgba(0, 0, 0, 0.4);
}

.table {
  position: absolute;
  inset: 10px;
  border-radius: 999px;
  background: radial-gradient(circle at 50% 40%, #146048, var(--felt) 46%, var(--felt-deep) 80%);
  box-shadow: inset 0 0 0 3px rgba(226, 192, 120, 0.18), inset 0 0 80px rgba(0, 0, 0, 0.35);
}

.felt-glow {
  position: absolute;
  inset: 18%;
  border: 1px dashed rgba(226, 192, 120, 0.18);
  border-radius: 999px;
}

.dealer {
  position: absolute;
  left: 50%;
  top: 2%;
  transform: translateX(-50%);
  z-index: 8;
  width: 88px;
  text-align: center;
  pointer-events: none;
}

.dealer svg {
  width: 54px;
  height: 60px;
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.45));
}

.dealer em {
  display: block;
  margin-top: -6px;
  font-style: normal;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #d8c48a;
}

.dealer.throwing svg {
  animation: throw 0.7s ease;
}

@keyframes throw {
  0% {
    transform: translateY(0);
  }
  35% {
    transform: translateY(-12px) rotate(-10deg);
  }
  70% {
    transform: translateY(-4px) rotate(6deg);
  }
  100% {
    transform: none;
  }
}

.center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(400px, 68%);
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

#seats {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.pot strong {
  display: block;
  color: var(--gold);
  font-size: 22px;
}

.board {
  display: flex;
  gap: 6px;
  min-height: 62px;
}

.street,
.log {
  margin: 0;
  max-width: 100%;
  color: #d9c89a;
  font-size: 14px;
  white-space: pre-line;
}

.hud .log {
  text-align: center;
  min-height: 1.3em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seat {
  position: absolute;
  width: 118px;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  z-index: 6;
}

.seat.empty {
  width: 72px;
  opacity: 0.4;
  z-index: 1;
}

.seat.empty .chair {
  width: 46px;
  height: 46px;
  margin: 0 auto 6px;
  border: 2px dashed rgba(226, 192, 120, 0.28);
  border-radius: 50%;
}

.seat.empty .who {
  color: #9a8b6a;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 11px;
}

.seat .who {
  font-size: 13px;
  margin-bottom: 4px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seat:not(.empty) {
  background: rgba(7, 11, 9, 0.78);
  border: 1px solid rgba(226, 192, 120, 0.18);
  border-radius: 12px;
  padding: 6px 8px;
  width: auto;
  min-width: 92px;
  max-width: 140px;
}

.seat .stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--gold);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.15;
}

.seat .stack small {
  color: var(--mute);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.seat.actor {
  padding: 8px 6px;
  border-radius: 10px;
  outline: 2px solid rgba(70, 210, 120, 0.85);
  outline-offset: 4px;
  animation: actorPulse 1.7s ease-in-out infinite;
}

.seat .inpot {
  color: #8a8270;
  font-size: 11px;
}

.entry-status {
  font-size: 11px;
  line-height: 1.2;
  margin: 1px 0 3px;
}

.entry-status.in {
  color: rgba(90, 180, 120, 0.55);
}

.entry-status.wait {
  color: #8a8270;
}

@keyframes actorPulse {
  0%,
  100% {
    outline-color: rgba(70, 210, 120, 0.28);
    box-shadow: 0 0 0 2px rgba(70, 210, 120, 0.12);
  }
  50% {
    outline-color: #46d278;
    box-shadow: 0 0 0 4px rgba(70, 210, 120, 0.28);
  }
}

.seat.folded {
  opacity: 0.42;
}

.badge {
  display: inline-block;
  margin: 0 2px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.cards {
  display: flex;
  justify-content: center;
  gap: 4px;
}

.card {
  width: 52px;
  height: 74px;
  border-radius: 8px;
  background: #f7f1e6;
  color: #1a1a1a;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 5px 6px;
  font-weight: 700;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.28);
}

.card.red {
  color: var(--red);
}

.card.back {
  background: repeating-linear-gradient(45deg, #6e1d2a, #6e1d2a 6px, #4d121c 6px, #4d121c 12px);
  color: transparent;
}

.card.ghost {
  opacity: 0.28;
  background: rgba(255, 255, 255, 0.08);
}

.card b,
.card i {
  font-style: normal;
  line-height: 1;
}

.card i {
  align-self: flex-end;
}

.hud {
  width: min(980px, 100%);
  flex: 0 0 auto;
  margin: 6px auto 0;
  display: grid;
  gap: 6px;
}

.hero-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.hero-hole {
  display: flex;
  justify-content: center;
  gap: 8px;
  min-height: 76px;
}

.hero-hole .card {
  width: 54px;
  height: 76px;
}

.hero-cash {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  color: var(--gold);
  min-width: 72px;
}

.hero-cash span {
  color: var(--mute);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-cash b {
  color: var(--gold);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.1;
}

.turn-clock {
  width: 42px;
  height: 42px;
  border: 2px solid var(--gold);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--gold);
  font-weight: 700;
}

.turn-clock.warn {
  border-color: #e35a5a;
  color: #e35a5a;
}

.stake-box {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--mute);
  font-size: 12px;
}

.stake-box input {
  width: 84px;
  padding: 8px 10px;
}

.entry-wait {
  width: 100%;
  margin: 0 0 4px;
  text-align: center;
  color: #d9c89a;
  font-size: 14px;
}

.ante-edit {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  justify-content: center;
  color: var(--mute);
  font-size: 13px;
}

.ante-edit input {
  width: 84px;
  margin-left: 6px;
}

.hud-meta {
  display: flex;
  justify-content: space-between;
  color: var(--mute);
}

.controls {
  justify-content: center;
}

.hidden {
  display: none !important;
}

.felt.sweeping .card,
.felt.sweeping .inpot,
.felt.sweeping .badge,
.felt.sweeping .log {
  animation: sweepOut 0.45s ease forwards;
}

@keyframes sweepOut {
  to {
    opacity: 0;
    transform: translateY(-14px) scale(0.9);
  }
}

#chatToggle {
  position: relative;
}

.chat-dot {
  position: absolute;
  top: 2px;
  right: -2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #46d278;
  box-shadow: 0 0 0 2px #070b09;
}

.chat-panel {
  position: fixed;
  right: 12px;
  top: 58px;
  bottom: 18px;
  width: min(320px, calc(100vw - 24px));
  z-index: 20;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(16, 22, 19, 0.96), rgba(8, 12, 10, 0.96));
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 8px;
  color: var(--gold);
}

.chat-close {
  border: 0;
  background: none;
  color: var(--mute);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.chat-log {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 8px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-line {
  font-size: 13px;
  line-height: 1.35;
}

.chat-line b {
  color: var(--gold);
  font-weight: 600;
  margin-right: 6px;
}

.chat-line.sys {
  color: #d9c89a;
}

.chat-line.sys b {
  color: #d9c89a;
}

.chat-line.mine b {
  color: #86d4a4;
}

.chat-form {
  display: flex;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--line);
}

.chat-form input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
}

.chat-form .btn {
  flex: 0 0 auto;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #1b140c;
  border: 1px solid var(--gold-dim);
  color: var(--gold);
  padding: 10px 16px;
  border-radius: 12px;
}

dialog {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #101612;
  color: var(--ink);
  width: min(520px, 92vw);
  padding: 22px;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
}

@media (max-width: 720px) {
  .brand {
    gap: 6px;
  }
  .brand strong {
    font-size: 20px;
    letter-spacing: 0.02em;
  }
  .diamond {
    font-size: 22px;
  }
  .mode-label {
    display: none;
  }
  .table-pot:not(.hidden) {
    flex: 1 1 100%;
    order: 5;
    font-size: 15px;
    padding: 4px 0 2px;
  }
  .table-pot b {
    font-size: 16px;
  }
  .top-right {
    gap: 8px;
  }
  .wallet {
    padding: 4px 10px;
  }
  .wallet b {
    font-size: 16px;
  }
  .rail {
    border-radius: 48px;
    padding: 8px;
  }
  .table {
    border-radius: 48px;
  }
  .seat {
    width: 88px;
  }
  .seat:not(.empty) {
    min-width: 84px;
    max-width: 38vw;
    padding: 5px 6px;
  }
  .dealer {
    width: 70px;
  }
  .dealer svg {
    width: 44px;
    height: 48px;
  }
  .card {
    width: 36px;
    height: 52px;
    font-size: 12px;
  }
  .hero-hole .card {
    width: 48px;
    height: 68px;
  }
  .hero-cash b {
    font-size: 18px;
  }
  .btn {
    padding: 8px 12px;
    font-size: 13px;
  }
}
