/* ── Reset / base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --felt:       #1a6b3c;
  --felt-dark:  #145530;
  --felt-light: #22894e;
  --card-bg:    #fff;
  --card-red:   #d32f2f;
  --card-black: #111;
  --gold:       #f5c518;
  --chip:       #e3a020;
  --bg:         #0e3a21;
  --text:       #f0f0f0;
  --text-dim:   #a0b8a8;
  --btn-primary:#2e7d32;
  --btn-hover:  #1b5e20;
  --btn-sec:    #455a64;
  --btn-sec-h:  #263238;
  --error:      #e53935;
  --highlight:  #ffe082;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 12px;
}

#app { width: 100%; max-width: 880px; }

/* ── Input panel ──────────────────────────────────────────────────────── */
#input-panel h1 { font-size: 2rem; color: var(--gold); margin-bottom: 4px; }
.subtitle { color: var(--text-dim); margin-bottom: 16px; font-size: 0.95rem; }

textarea#hand-input {
  width: 100%; padding: 12px; border-radius: 8px;
  border: 1px solid #2e6e48; background: #0b2e18; color: var(--text);
  font-family: 'Courier New', monospace; font-size: 0.85rem;
  resize: vertical; outline: none;
}
textarea#hand-input:focus { border-color: var(--gold); }

.input-actions { display: flex; gap: 10px; margin-top: 12px; }

button {
  cursor: pointer; border: none; border-radius: 6px;
  padding: 10px 22px; font-size: 0.95rem; font-weight: 600;
  transition: background 0.15s, transform 0.1s;
}
button:active { transform: scale(0.97); }
#replay-btn   { background: var(--btn-primary); color: #fff; }
#replay-btn:hover { background: var(--btn-hover); }
button.secondary { background: var(--btn-sec); color: #fff; }
button.secondary:hover { background: var(--btn-sec-h); }

.error   { color: var(--error); margin-top: 10px; font-size: 0.9rem; white-space: pre-wrap; }
.warning { color: #f9a825; background: rgba(249,168,37,0.1); border-radius: 6px;
           padding: 6px 10px; margin-bottom: 10px; font-size: 0.8rem; word-break: break-word; }
.hidden { display: none !important; }

/* ── Replayer panel ───────────────────────────────────────────────────── */
#hand-info {
  display: flex; gap: 16px; flex-wrap: wrap;
  font-size: 0.82rem; color: var(--text-dim); margin-bottom: 12px;
}
#hand-info span::before { content: attr(data-label)': '; color: var(--gold); font-weight: 600; }

/* ── Table ────────────────────────────────────────────────────────────── */
#table-container {
  display: flex; justify-content: center; margin-bottom: 16px;
}

#poker-table {
  position: relative;
  width: 720px; height: 360px;
  background: radial-gradient(ellipse 80% 70% at 50% 50%, var(--felt-light), var(--felt-dark));
  border-radius: 50%;
  border: 10px solid #3d2006;
  box-shadow: 0 0 0 4px #6d3a0a, 0 8px 40px rgba(0,0,0,0.6);
  overflow: visible;
}

/* ── Community cards ──────────────────────────────────────────────────── */
#community-cards {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}

#board-cards { display: flex; gap: 6px; min-height: 70px; align-items: center; }

#pot-display {
  font-size: 0.85rem; font-weight: 700; color: var(--gold);
  background: rgba(0,0,0,0.45); padding: 3px 10px; border-radius: 12px;
}

/* ── Playing card ─────────────────────────────────────────────────────── */
.card {
  width: 46px; height: 66px;
  background: var(--card-bg);
  border-radius: 5px;
  border: 1px solid #ccc;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-weight: 900; font-size: 1.05rem;
  box-shadow: 1px 2px 4px rgba(0,0,0,0.45);
  line-height: 1;
  user-select: none;
  transition: transform 0.18s;
}
.card.red  { color: var(--card-red); }
.card.black{ color: var(--card-black); }
.card.back {
  background: linear-gradient(135deg, #1a237e 25%, #283593 100%);
  border-color: #3949ab; color: transparent;
  font-size: 1.4rem;
}
.card .rank { font-size: 0.95rem; line-height: 1; }
.card .suit { font-size: 1rem; line-height: 1; }

/* ── Seats ────────────────────────────────────────────────────────────── */
.seat {
  position: absolute;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  transform: translate(-50%, -50%);
}

.seat-box {
  background: rgba(0,0,0,0.7);
  border: 2px solid #3d5a45;
  border-radius: 10px;
  padding: 5px 10px;
  min-width: 110px;
  text-align: center;
  transition: border-color 0.2s, background 0.2s;
}
.seat-box.active   { border-color: var(--gold); background: rgba(50,30,0,0.85); }
.seat-box.folded   { opacity: 0.45; }
.seat-box.winner   { border-color: #66bb6a; background: rgba(0,60,15,0.85); }
.seat-box.is-btn   { border-color: #90caf9; }

.seat-name  { font-size: 0.8rem; font-weight: 700; color: #e8f5e9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100px; }
.seat-stack { font-size: 0.75rem; color: var(--text-dim); }
.seat-bet   { font-size: 0.72rem; color: var(--chip); font-weight: 700; min-height: 14px; }
.seat-bounty{ font-size: 0.68rem; color: #e040fb; font-weight: 700; }

.seat-cards { display: flex; gap: 3px; }
.seat-cards .card { width: 32px; height: 46px; font-size: 0.75rem; }
.seat-cards .card .suit { font-size: 0.78rem; }

.dealer-btn {
  position: absolute; bottom: -8px; right: -8px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--gold); color: #000; font-size: 0.55rem; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

/* ── Street indicator ─────────────────────────────────────────────────── */
#street-indicator {
  display: flex; gap: 8px; justify-content: center; margin-bottom: 12px; flex-wrap: wrap;
}
.street-badge {
  padding: 4px 14px; border-radius: 20px;
  background: rgba(255,255,255,0.08); color: var(--text-dim); font-size: 0.82rem;
  transition: background 0.2s, color 0.2s;
}
.street-badge.active { background: var(--gold); color: #1a1a1a; font-weight: 700; }
.street-badge.done   { background: rgba(255,255,255,0.15); color: var(--text); }

/* ── Action log ───────────────────────────────────────────────────────── */
#action-log {
  background: rgba(0,0,0,0.35); border-radius: 8px;
  padding: 10px 14px; margin-bottom: 14px; min-height: 54px;
}
#action-log h3 { font-size: 0.78rem; color: var(--text-dim); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.05em; }
#action-text  { font-size: 0.95rem; color: var(--highlight); font-weight: 600; }

/* ── Controls ─────────────────────────────────────────────────────────── */
#controls {
  display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap;
}
#controls button { padding: 8px 16px; font-size: 1.1rem; }
#step-counter { font-size: 0.85rem; color: var(--text-dim); min-width: 80px; text-align: center; }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  #poker-table { width: 340px; height: 200px; }
  .seat-box { min-width: 80px; padding: 3px 6px; }
  .seat-name  { font-size: 0.68rem; max-width: 72px; }
  .seat-cards .card { width: 24px; height: 34px; font-size: 0.6rem; }
  .card { width: 36px; height: 52px; font-size: 0.85rem; }
}
