:root {
  --bg: #f3f5f7;
  --ink: #15171c;
  --muted: #667080;
  --surface: #ffffff;
  --line: #d8dee8;
  --felt: #12634f;
  --felt-dark: #0b322a;
  --rail: #3a2117;
  --charcoal: #111318;
  --mint: #23d69d;
  --amber: #f4bc42;
  --danger: #ef6b5a;
  --shadow: 0 18px 50px rgba(17, 19, 24, 0.14);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(140deg, rgba(35, 214, 157, 0.13), transparent 34%),
    linear-gradient(320deg, rgba(244, 188, 66, 0.14), transparent 30%),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app-shell {
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 42px;
}

.topbar,
.top-actions,
.brand,
.table-top,
.section-title {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.table-route .topbar {
  display: none;
}

.table-route .app-shell {
  width: min(1180px, calc(100% - 16px));
  padding-top: 8px;
}

.admin-route .app-shell {
  width: min(980px, calc(100% - 28px));
}

.brand {
  gap: 12px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.brand h1,
.hero-panel h2 {
  margin: 0;
  line-height: 1;
}

.brand h1 {
  font-size: 2rem;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.top-actions {
  gap: 8px;
}

.wallet-pill,
.miniapp-action,
.ghost-button,
.primary-action,
.action-row button,
.chat-form button {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 15px;
  font-weight: 900;
}

.wallet-pill,
.ghost-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.miniapp-action,
.primary-action,
.action-row button,
.chat-form button {
  background: var(--charcoal);
  color: #ffffff;
}

.screen {
  display: grid;
  gap: 16px;
}

.lobby-screen {
  grid-template-columns: minmax(0, 1fr) 300px;
}

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

.hero-panel,
.info-panel,
.table-panel,
.chat-panel,
.fair-panel,
.admin-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.hero-panel {
  min-height: 390px;
  display: grid;
  align-content: center;
  gap: 18px;
  padding: clamp(22px, 5vw, 56px);
  background:
    radial-gradient(circle at 82% 18%, rgba(35, 214, 157, 0.2), transparent 22%),
    linear-gradient(180deg, #ffffff, #f7f9fb);
}

.hero-panel h2 {
  max-width: 680px;
  font-size: clamp(2.2rem, 7vw, 4.9rem);
  letter-spacing: 0;
}

.muted,
.lobby-actions span,
.notice,
.status-line,
.last-chat {
  color: var(--muted);
  font-weight: 750;
}

.muted {
  max-width: 620px;
  margin: 0;
  font-size: 1.05rem;
}

.lobby-actions {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.primary-action {
  background: var(--mint);
  color: #041e17;
}

.info-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.info-panel > div,
.status-grid > div {
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

.info-panel span,
.status-grid span,
.pot-box span,
.pot-box small {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.info-panel strong,
.status-grid strong {
  display: block;
  margin-top: 8px;
  overflow-wrap: anywhere;
  font-size: 1.12rem;
}

.table-screen {
  grid-template-columns: 1fr;
}

.table-top {
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
  box-shadow: var(--shadow);
}

.table-top strong {
  display: block;
  overflow-wrap: anywhere;
}

.timer-pill {
  min-width: 62px;
  min-height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--amber);
  color: #251903;
  font-weight: 1000;
}

.table-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 16px;
}

.poker-table {
  position: relative;
  min-height: 620px;
  overflow: hidden;
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 45%, rgba(244, 188, 66, 0.13), transparent 25%),
    linear-gradient(180deg, #12151d, #07090d);
  box-shadow: var(--shadow);
}

.felt {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 178px;
  height: 278px;
  display: grid;
  place-items: center;
  border: 12px solid var(--rail);
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 42%, rgba(35, 214, 157, 0.22), transparent 43%),
    linear-gradient(145deg, var(--felt), var(--felt-dark));
  box-shadow:
    0 24px 42px rgba(0, 0, 0, 0.42),
    inset 0 0 0 2px rgba(255, 255, 255, 0.08);
}

.pot-box {
  min-width: 154px;
  min-height: 82px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffd76a, #efae31);
  color: #211804;
  box-shadow: 0 14px 22px rgba(0, 0, 0, 0.28);
}

.pot-box strong {
  font-size: 1.3rem;
}

.community,
.hand {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.community {
  position: absolute;
  bottom: 54px;
}

.card {
  width: 46px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: linear-gradient(135deg, #ffffff, #edf2f8);
  color: #111318;
  box-shadow:
    0 8px 16px rgba(0, 0, 0, 0.2),
    inset 0 0 0 1px rgba(17, 19, 24, 0.08);
  font-weight: 1000;
}

.card.red {
  color: #d94b43;
}

.card.back {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.14), transparent 35%),
    #273044;
}

.seat {
  position: absolute;
  width: min(250px, 42%);
  min-height: 88px;
  display: grid;
  gap: 6px;
  align-content: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: linear-gradient(180deg, #252b35, #151a22);
  color: #ffffff;
  padding: 14px;
  box-shadow: 0 14px 24px rgba(0, 0, 0, 0.32);
}

.seat-one {
  left: 8%;
  top: 30px;
}

.seat-two {
  right: 8%;
  top: 30px;
}

.seat-three {
  left: 2.5%;
  top: 262px;
}

.seat-four {
  right: 2.5%;
  top: 262px;
}

.seat-five {
  left: 8%;
  bottom: 28px;
}

.seat-six {
  right: 8%;
  bottom: 28px;
}

.seat span {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.seat strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
}

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

.cards-block {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
}

.notice,
.status-line {
  margin: 0;
}

.notice {
  border: 1px solid #f1d58c;
  border-radius: 8px;
  background: #fff8e3;
  color: #6d4b03;
  padding: 10px;
  font-size: 0.86rem;
}

.action-row {
  display: grid;
  gap: 8px;
}

.action-row label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.action-row input,
.chat-form input {
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 0 12px;
  font-weight: 850;
}

#confirmButton,
#callButton,
#claimButton {
  background: var(--mint);
  color: #041e17;
}

#foldButton,
#timeoutButton {
  background: var(--danger);
}

.chat-panel {
  padding: 14px;
}

.lobby-tables-panel {
  display: grid;
  gap: 10px;
}

.lobby-tables {
  display: grid;
  gap: 10px;
}

.lobby-table-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
}

.lobby-table-card strong,
.lobby-table-card span {
  display: block;
  overflow-wrap: anywhere;
}

.lobby-table-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

.lobby-table-meta span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  padding: 4px 8px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.lobby-table-card button {
  min-width: 92px;
  min-height: 40px;
  border-radius: 8px;
  background: var(--charcoal);
  color: #ffffff;
  font-weight: 1000;
}

.fair-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.fair-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.fair-grid > div {
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
}

.fair-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.fair-grid strong {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
  font-size: 0.84rem;
}

.section-title {
  justify-content: space-between;
  margin-bottom: 10px;
}

.last-chat {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px;
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 10px;
}

.admin-screen {
  grid-template-columns: 1fr;
}

.admin-panel {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.field-label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.field-label input {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  font-weight: 850;
}

.token-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.token-row button {
  min-height: 44px;
  border-radius: 8px;
  background: var(--mint);
  color: #041e17;
  padding: 0 14px;
  font-weight: 900;
}

.admin-state {
  display: grid;
  gap: 8px;
}

.admin-table-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
}

.admin-table-row strong,
.admin-table-row span {
  overflow-wrap: anywhere;
}

.admin-table-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.admin-table-meta div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  background: #f8fafc;
}

.admin-table-meta span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.admin-table-meta strong {
  display: block;
  margin-top: 4px;
}

.admin-table-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 160px));
  gap: 8px;
}

.admin-table-actions button {
  min-height: 38px;
  border-radius: 8px;
  font-weight: 900;
}

.admin-open-button {
  background: var(--charcoal);
  color: #ffffff;
}

.admin-lobby-button {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
}

.wallet-sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(17, 19, 24, 0.42);
}

.wallet-card {
  width: min(420px, 100%);
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
  box-shadow: var(--shadow);
}

.wallet-options {
  display: grid;
  gap: 8px;
}

.wallet-option {
  min-height: 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--ink);
  padding: 0 12px;
  font-weight: 900;
}

.compact-button {
  min-height: 34px;
  padding: 0 10px;
}

@media (max-width: 900px) {
  .lobby-screen,
  .table-layout,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .lobby-side .info-panel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: 100%;
    padding: 8px;
  }

  .topbar {
    display: grid;
    gap: 8px;
  }

  .top-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .brand h1 {
    font-size: 1.44rem;
  }

  .wallet-pill,
  .miniapp-action {
    width: 100%;
    min-height: 36px;
    padding: 0 8px;
    font-size: 0.86rem;
  }

  .hero-panel {
    min-height: 330px;
    padding: 18px;
  }

  .hero-panel h2 {
    font-size: 2.55rem;
  }

  .lobby-actions,
  .info-panel,
  .status-grid,
  .fair-grid,
  .chat-form,
  .token-row,
  .admin-table-meta,
  .admin-table-actions {
    grid-template-columns: 1fr;
  }

  .table-top {
    grid-template-columns: 80px minmax(0, 1fr) 54px;
  }

  .poker-table {
    min-height: 560px;
  }

  .felt {
    left: 4%;
    right: 4%;
    top: 184px;
    height: 198px;
    border-width: 8px;
  }

  .seat {
    width: 46%;
    min-height: 72px;
    padding: 10px;
  }

  .seat-one {
    left: 4%;
    top: 24px;
  }

  .seat-two {
    right: 4%;
    top: 24px;
  }

  .seat-three {
    left: 4%;
    top: 108px;
  }

  .seat-four {
    right: 4%;
    top: 108px;
  }

  .seat-five {
    left: 4%;
    bottom: 24px;
  }

  .seat-six {
    right: 4%;
    bottom: 24px;
  }

  .pot-box {
    min-width: 118px;
    min-height: 62px;
  }

  .community {
    gap: 5px;
    bottom: 34px;
  }

  .card {
    width: 32px;
    height: 45px;
    border-radius: 5px;
    font-size: 0.82rem;
  }
}
