:root {
  color-scheme: dark light;
  --bg: #0b1714;
  --ink: #17201a;
  --muted: #697469;
  --panel: #fbfaf4;
  --line: #d3dccf;
  --green: #0f8f5b;
  --green-dark: #0b5f42;
  --red: #b5263b;
  --gold: #d9a73b;
  --felt: #075235;
  --shadow: 0 16px 38px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 0%, rgba(217, 167, 59, 0.18), transparent 24rem),
    radial-gradient(circle at 88% 8%, rgba(181, 38, 59, 0.16), transparent 20rem),
    linear-gradient(180deg, #10241f 0%, var(--bg) 58%, #08110f 100%);
  color: #f4efe0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
select,
input {
  font: inherit;
}

.app {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 18px 14px 28px;
}

.topbar,
.deck-head,
.hand-line,
.hero-seat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar {
  padding: 8px 2px 14px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.1;
  color: #fff7df;
}

h2 {
  font-size: 18px;
}

.hidden {
  display: none;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--green-dark);
  font-size: 24px;
  box-shadow: var(--shadow);
}

.mode-tabs,
.segmented {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  padding: 4px;
  border-radius: 8px;
  background: #edf2ea;
}

.mode-tabs {
  margin-bottom: 14px;
}

.mode-tabs button,
.segmented button {
  height: 40px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.mode-tabs button.active,
.segmented button.active {
  background: var(--panel);
  color: var(--green-dark);
  box-shadow: 0 4px 14px rgba(35, 54, 41, 0.1);
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.result-panel,
.controls,
.game-panel {
  padding: 14px;
}

.controls,
.deck-wrap,
.game-panel {
  margin-top: 14px;
}

.deck-wrap,
.support-footer {
  color: var(--ink);
}

.result-main,
.game-head {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.result-main div,
.game-head div,
.hero-stack,
.bot {
  min-width: 0;
  padding: 12px 10px;
  border-radius: 8px;
  background: #f4f8f1;
}

.game-head div {
  padding: 8px 8px;
}

.label,
.slot-title,
.settings span,
.game-settings span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.result-main strong,
.game-head strong,
.hero-stack strong {
  display: block;
  margin-top: 3px;
  font-size: clamp(22px, 8vw, 34px);
  line-height: 1;
  color: var(--green-dark);
}

.game-head strong {
  font-size: 18px;
}

.hand-line {
  margin-top: 13px;
  color: var(--muted);
  font-size: 14px;
}

.slots {
  display: grid;
  gap: 12px;
  margin: 15px 0;
}

.slot-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(54px, 72px));
  gap: 8px;
  margin-top: 6px;
}

.slot-row.board {
  grid-template-columns: repeat(5, minmax(45px, 1fr));
}

.card,
.empty-slot,
.card-back {
  aspect-ratio: 0.72;
  min-height: 64px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-weight: 900;
  user-select: none;
}

.empty-slot {
  border: 1px dashed #b9c5b5;
  color: #9aa79a;
  background: #f8faf7;
}

.card {
  border: 1px solid #cfd8cc;
  background: #fff;
  color: #151a17;
  box-shadow: 0 5px 12px rgba(25, 35, 30, 0.08);
}

.card-back {
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: linear-gradient(135deg, #155c87, #19344c);
  color: rgba(255, 255, 255, 0.76);
}

.card.red {
  color: var(--red);
}

.card.selected {
  border-color: var(--gold);
  background: #fff7df;
  box-shadow: inset 0 0 0 2px rgba(194, 138, 32, 0.26);
}

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

select,
input {
  width: 100%;
  height: 42px;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
}

.game-settings {
  margin-bottom: 14px;
}

.primary,
.game-actions button {
  height: 48px;
  border-radius: 8px;
  font-weight: 900;
}

.primary {
  width: 100%;
  margin-top: 14px;
  border: 0;
  background: var(--green);
  color: #fff;
  box-shadow: 0 10px 22px rgba(21, 127, 79, 0.26);
}

.primary:disabled,
.game-actions button:disabled {
  opacity: 0.55;
}

#pickHint {
  color: var(--muted);
  font-size: 13px;
}

.deck {
  display: grid;
  grid-template-columns: repeat(13, minmax(0, 1fr));
  gap: 4px;
  margin-top: 10px;
}

.deck .card {
  min-height: 34px;
  border-radius: 5px;
  font-size: 12px;
  box-shadow: 0 2px 6px rgba(25, 35, 30, 0.08);
}

.table {
  position: relative;
  margin-top: 14px;
  min-height: 390px;
  padding: 12px;
  border-radius: 22px;
  background:
    radial-gradient(ellipse at center, rgba(255, 255, 255, 0.16), transparent 12rem),
    radial-gradient(ellipse at center, rgba(217, 167, 59, 0.18), transparent 15rem),
    var(--felt);
  overflow: hidden;
  box-shadow: inset 0 0 0 8px rgba(59, 35, 18, 0.22);
}

.opponent-strip {
  position: absolute;
  inset: 8px;
  pointer-events: none;
}

.bot {
  position: absolute;
  z-index: 2;
  width: 82px;
  min-height: 58px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
  pointer-events: auto;
}

.bot .action-bubble {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.16);
}

.bot.folded {
  opacity: 0.48;
}

.seat-0 {
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
}

.seat-1 {
  top: 72px;
  right: 4px;
}

.seat-2 {
  bottom: 82px;
  right: 4px;
}

.seat-3 {
  bottom: 82px;
  left: 4px;
}

.seat-4 {
  top: 72px;
  left: 4px;
}

.total-2.seat-0 {
  top: 18px;
}

.total-3.seat-0 {
  top: 18px;
}

.total-3.seat-1 {
  right: 14px;
  top: 145px;
}

.total-4.seat-1,
.total-5.seat-1,
.total-6.seat-1 {
  top: 80px;
}

.bot-name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  font-weight: 900;
  font-size: 12px;
}

.role-badge {
  display: inline-grid;
  place-items: center;
  min-width: 27px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ffeab3;
  color: #6b4700;
  font-size: 10px;
  font-weight: 900;
}

.bot-state {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.1;
}

.action-bubble {
  display: inline-flex;
  max-width: 100%;
  min-height: 22px;
  align-items: center;
  margin-top: 6px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #173f2f;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.mini-cards {
  display: flex;
  gap: 3px;
  margin-top: 5px;
}

.mini-cards .card,
.mini-cards .card-back {
  min-height: 24px;
  width: 18px;
  font-size: 9px;
  border-radius: 4px;
}

.hidden-cards {
  position: absolute;
  right: 6px;
  bottom: 5px;
  margin-top: 0;
}

.hidden-cards .card-back {
  min-height: 14px;
  width: 10px;
  border-radius: 3px;
  font-size: 0;
  box-shadow: none;
}

.hidden-cards .card-back::after {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
}

.table-center {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  width: min(280px, calc(100% - 84px));
  transform: translate(-50%, -56%);
  padding: 11px 10px 13px;
  border-radius: 999px;
  background: rgba(7, 69, 45, 0.88);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.12);
}

.table .slot-title {
  color: rgba(255, 255, 255, 0.78);
  text-align: center;
}

.hero-seat {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 10px;
  width: 124px;
  min-width: 124px;
  transform: translateX(-50%);
  align-items: end;
  padding: 6px;
  gap: 4px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.18);
}

.hero-seat .action-bubble {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.16);
}

.hero-stack {
  width: 34px;
  text-align: right;
  padding: 5px 4px;
}

.hero-stack strong {
  font-size: 14px;
}

.hero-seat .slot-row {
  grid-template-columns: repeat(2, 28px);
  gap: 3px;
}

.hero-seat .card,
.hero-seat .empty-slot {
  min-height: 34px;
  border-radius: 6px;
  font-size: 11px;
}

.table-center .card,
.table-center .empty-slot {
  min-height: 48px;
  border-radius: 6px;
  font-size: 13px;
}

.table-center .slot-row.board {
  grid-template-columns: repeat(5, minmax(32px, 1fr));
  gap: 5px;
}

.game-message {
  min-height: 42px;
  margin-top: 12px;
  padding: 11px 12px;
  border-radius: 8px;
  background: #f4f8f1;
  color: var(--muted);
  line-height: 1.35;
}

.action-log {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-top: 10px;
}

.action-log-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 7px 8px;
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
}

.action-log-row.system {
  grid-column: 1 / -1;
  align-items: flex-start;
  padding: 9px 10px;
  border: 1px solid rgba(217, 167, 59, 0.32);
  background:
    linear-gradient(90deg, rgba(217, 167, 59, 0.18), rgba(7, 82, 53, 0.08)),
    #fffaf0;
  color: #5e4720;
}

.action-log-row strong {
  color: var(--ink);
}

.action-index {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #edf2ea;
  color: var(--green-dark);
  font-size: 11px;
  font-weight: 900;
}

.action-log-row.system .action-index {
  background: #8c6420;
  color: #fff8dc;
}

.action-player {
  flex: 0 1 auto;
  min-width: 36px;
  font-weight: 900;
  color: var(--ink);
}

.action-log-row.system .action-player {
  min-width: 34px;
  color: #7c5617;
}

.action-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action-log-row.system .action-text {
  white-space: normal;
  line-height: 1.35;
  color: #493516;
  font-weight: 800;
}

.game-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.game-actions .primary {
  margin-top: 0;
}

.game-actions button:not(.primary) {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--green-dark);
}

.game-actions .danger {
  grid-column: span 2;
  border: 0;
  background: #a91f32;
  color: #fff;
  box-shadow: 0 10px 20px rgba(169, 31, 50, 0.2);
}

.support-footer {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(251, 250, 244, 0.95);
  box-shadow: var(--shadow);
}

.support-copy {
  display: flex;
  align-items: center;
  gap: 12px;
}

.all-in-mark {
  display: inline-grid;
  flex: 0 0 62px;
  width: 62px;
  height: 62px;
  place-items: center;
  border: 3px solid #f5d77c;
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 26%, rgba(255, 255, 255, 0.3), transparent 1.1rem),
    conic-gradient(from 8deg, #b71f36, #7f1324, #b71f36, #d9a73b, #b71f36);
  color: #fff;
  font-size: 15px;
  font-weight: 1000;
  line-height: 0.92;
  text-align: center;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.35);
  box-shadow: 0 10px 20px rgba(169, 31, 50, 0.28);
}

.all-in-mark small {
  display: block;
  font-size: 9px;
  letter-spacing: 0;
}

.support-title {
  margin: 0;
  color: var(--green-dark);
  font-size: 17px;
  font-weight: 900;
}

.support-text {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.support-codes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.support-codes figure {
  margin: 0;
  min-width: 0;
  padding: 8px;
  border: 1px solid #e1e8de;
  border-radius: 8px;
  background: #f8faf7;
}

.support-codes img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
}

.support-codes figcaption,
.creator {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.support-codes figcaption {
  margin-top: 6px;
}

.creator {
  margin: 12px 0 0;
  text-transform: uppercase;
  letter-spacing: 0;
}

@media (min-width: 560px) {
  .app {
    padding-top: 28px;
  }

  .slots {
    grid-template-columns: 0.82fr 1.18fr;
  }

  .deck .card {
    min-height: 42px;
    font-size: 14px;
  }

  .table {
    min-height: 460px;
  }

  .bot {
    width: 98px;
  }

  .action-log {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .support-footer {
    padding: 16px;
  }

  .support-codes {
    gap: 14px;
  }
}
