/* The look of the AlphaHoldem webapp (~/pluribus/webapp), for a two-seat table. */
:root {
  --bg: #0d1117;
  --panel: #161b22;
  --panel-2: #1c2330;
  --felt: #1c4532;
  --felt-edge: #2f6b4f;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #58a6ff;
  --gold: #d4a017;
  --red: #ef5350;
  --green: #4caf7d;
  --card-bg: #f5f2ea;
  --card-red: #c62828;
  --card-black: #1a1a1a;
  --card-green: #18713c;
  --card-blue: #1565c0;
  --radius: 12px;
  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header { text-align: center; padding: 1.2rem 1rem 0.4rem; }
header h1 { margin: 0; font-size: 1.6rem; letter-spacing: 0.02em; }
header .tag {
  font-size: 0.7rem; vertical-align: middle; color: var(--accent);
  border: 1px solid rgba(88, 166, 255, 0.5); border-radius: 999px; padding: 0.1rem 0.5rem;
}
.subtitle { color: var(--muted); margin: 0.3rem auto 0; max-width: 44rem; font-size: 0.85rem; }

main { flex: 1; width: 100%; max-width: 56rem; margin: 0 auto; padding: 0.8rem 1rem; }
.hidden { display: none !important; }

.panel {
  background: var(--panel);
  border: 1px solid #30363d;
  border-radius: var(--radius);
  padding: 1.5rem;
}
#failure { color: var(--red); text-align: center; }

.loading { text-align: center; }
.spinner {
  width: 2.2rem; height: 2.2rem;
  border: 3px solid #30363d;
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 0.8rem;
  animation: spin 0.9s linear infinite;
}
.spinner.small { width: 1rem; height: 1rem; border-width: 2px; margin: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.2rem;
}
.score { font-weight: 600; }
.score .positive { color: var(--green); }
.score .negative { color: var(--red); }
.controls { display: flex; flex-wrap: wrap; gap: 0.9rem; align-items: center; color: var(--muted); font-size: 0.85rem; }
.controls select {
  background: var(--panel-2); color: var(--text);
  border: 1px solid #30363d; border-radius: 6px; padding: 0.25rem 0.4rem;
  margin-left: 0.3rem;
}
.toggle { cursor: pointer; user-select: none; }
.small-btn {
  background: var(--panel-2); color: var(--text);
  border: 1px solid #3d444d; border-radius: 6px;
  padding: 0.3rem 0.8rem; font-size: 0.85rem; cursor: pointer;
}
.small-btn:hover { border-color: var(--accent); }

.table-wrap { padding: 0.4rem 0; }
.table {
  position: relative;
  background: radial-gradient(ellipse at center, var(--felt) 0%, #143726 100%);
  border: 10px solid #3a2b18;
  outline: 2px solid var(--felt-edge);
  outline-offset: -12px;
  border-radius: 45% / 38%;
  min-height: 27rem;
  display: grid;
  grid-template-rows: 9.1rem 1fr 9.1rem;
  padding: 1rem;
}

.seat {
  display: flex; flex-direction: column; align-items: center; gap: 0.3rem;
  justify-self: center; align-self: center;
  min-width: 10rem;
  padding: 0.5rem 0.8rem;
  border-radius: var(--radius);
  background: rgba(13, 17, 23, 0.55);
  border: 1px solid transparent;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.seat.acting {
  border-color: var(--gold);
  box-shadow: 0 0 14px rgba(212, 160, 23, 0.35);
}
.seat.winner { box-shadow: 0 0 18px rgba(76, 175, 125, 0.6); border-color: var(--green); }
.seat-top { grid-row: 1; }
.seat-bottom { grid-row: 3; }
.seat .name { font-weight: 600; font-size: 0.9rem; display: flex; gap: 0.4rem; align-items: center; white-space: nowrap; }
.position-name {
  font-size: 0.65rem; font-weight: 700;
  color: #17130a;
  background: linear-gradient(145deg, #fff4bc, #d7a823);
  border-radius: 999px; padding: 0.05rem 0.4rem;
}
.position-name.bb { background: linear-gradient(145deg, #bce1ff, #508ac0); }
.seat .stack { color: var(--muted); font-size: 0.8rem; }
.seat .last-action { color: var(--accent); font-size: 0.78rem; min-height: 1.1em; }

/* Each player's chips this street, on its own row between its seat and the pot. */
.bet-spot {
  height: 1.4rem;
  color: #ffe081;
  font-size: 0.8rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  display: flex; align-items: center; justify-content: center; gap: 0.3rem;
}
.chip {
  width: 0.9rem; height: 0.9rem; border-radius: 50%;
  background: repeating-conic-gradient(#f4d75d 0deg 34deg, #8d6512 34deg 50deg);
  border: 1px solid rgba(18, 11, 0, 0.6);
}

.cards { display: flex; gap: 0.3rem; min-height: 3.4rem; }
.card {
  width: 2.4rem; height: 3.4rem;
  background: var(--card-bg);
  border-radius: 6px;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  font-weight: 700; font-size: 1.05rem; line-height: 1;
  box-shadow: 0 2px 5px rgba(0,0,0,0.45);
  animation: deal 0.3s cubic-bezier(.2, .9, .25, 1) both;
}
.card .suit { font-size: 1.1rem; }
.card.suit-h { color: var(--card-red); }
.card.suit-s { color: var(--card-black); }
.card.suit-c { color: var(--card-green); }
.card.suit-d { color: var(--card-blue); }
.card.back {
  background: repeating-linear-gradient(45deg, #2a4d8f, #2a4d8f 4px, #23407a 4px, #23407a 8px);
  border: 2px solid #d7dce3;
}
.card.card-reveal { animation: reveal-card 0.4s cubic-bezier(.2, .8, .25, 1) both; }
@keyframes reveal-card {
  0% { opacity: 0.4; transform: perspective(200px) rotateY(90deg) scale(0.92); }
  70% { opacity: 1; transform: perspective(200px) rotateY(-7deg) scale(1.04); }
  100% { opacity: 1; transform: perspective(200px) rotateY(0) scale(1); }
}
@keyframes deal {
  0% { opacity: 0; transform: translateY(-0.6rem) scale(0.9); }
  100% { opacity: 1; transform: none; }
}

.board-area { grid-row: 2; text-align: center; align-self: center; }
.pot {
  color: #ffe17b;
  font-weight: 700;
  margin-bottom: 0.4rem;
  min-height: 1.2em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}
.board { display: flex; gap: 0.35rem; justify-content: center; min-height: 3.4rem; }
.banner { margin-top: 0.5rem; font-weight: 600; min-height: 1.4em; }
.banner .win { color: var(--green); }
.banner .lose { color: var(--red); }

.action-area { min-height: 7rem; padding: 0.6rem 0.2rem; }
.thinking {
  display: flex; gap: 0.5rem; align-items: center; justify-content: center;
  color: var(--muted); font-size: 0.9rem; margin-bottom: 0.6rem;
}
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; }
.actions button {
  background: var(--panel-2); color: var(--text);
  border: 1px solid #3d444d; border-radius: 10px;
  padding: 0.75rem 1.1rem;
  font-size: 0.95rem; font-weight: 700;
  cursor: pointer;
  transition: filter 0.12s, border-color 0.12s;
  min-width: 7rem;
}
.actions button:hover { filter: brightness(1.2); }
.actions button:disabled { opacity: 0.35; cursor: default; }
.actions button.fold { border-color: #7a3b3b; color: #ff9b9b; }
.actions button.passive { border-color: #2f5e8f; color: #9ecbff; background: #17293c; }
.actions button.aggressive { border-color: #7a6420; color: #ffd766; background: #2c2410; }
.actions button.allin { border-color: #8a4e25; color: #ffc078; background: #321d11; }
.actions button.deal {
  background: var(--accent); color: #0d1117; border-color: var(--accent);
  padding: 0.7rem 1.8rem;
}
.actions .key { opacity: 0.55; font-weight: 500; font-size: 0.75rem; margin-left: 0.3rem; }
.shortcut-hint {
  max-width: 42rem;
  margin: 0.45rem auto 0;
  color: var(--muted);
  font-size: 0.74rem;
  text-align: center;
}
.solve-info { text-align: center; color: var(--muted); font-size: 0.75rem; margin-top: 0.6rem; min-height: 1em; }

.advice {
  max-width: 30rem; margin: 0 auto 0.7rem;
  background: var(--panel);
  border: 1px solid #30363d; border-radius: var(--radius);
  padding: 0.7rem 0.9rem;
  font-size: 0.8rem;
}
.advice h3 { margin: 0 0 0.4rem; font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.advice .row, .mix .row { display: flex; align-items: center; gap: 0.5rem; margin: 0.15rem 0; }
.advice .label, .mix .label { width: 8rem; }
.bar-track { display: block; flex: 1; height: 0.55rem; background: #21262d; border-radius: 999px; overflow: hidden; }
.bar { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.pct { width: 3.2rem; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

.log-wrap { margin: 0.4rem 0.2rem; color: var(--muted); font-size: 0.85rem; }
.log {
  max-height: 20rem; overflow-y: auto;
  background: var(--panel);
  border: 1px solid #30363d; border-radius: var(--radius);
  padding: 0.6rem 0.9rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.75rem;
  margin-top: 0.4rem;
}
.log .line { white-space: pre-wrap; }
.log .mix { margin: 0.1rem 0 0.35rem 1.2rem; max-width: 26rem; }
.log .mix .label { width: 9rem; }
.log .mix .bar { background: var(--gold); }
.log .chosen { color: var(--text); }

footer { text-align: center; color: var(--muted); font-size: 0.72rem; padding: 0.6rem 1rem 1.2rem; }
footer p { max-width: 46rem; margin: 0 auto; }

@media (max-width: 640px) {
  .table { min-height: 25rem; border-radius: 30% / 20%; }
  .card { width: 2rem; height: 2.9rem; font-size: 0.9rem; }
  .actions button { min-width: 6rem; padding: 0.7rem 0.8rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
