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

:root {
  --brown-dark:   #1a0a00;
  --brown-mid:    #3d1f00;
  --brown-light:  #7a4f1a;
  --gold:         #c8a84b;
  --gold-light:   #e8c96a;
  --felt:         #1a3a1a;
  --felt-light:   #245024;
  --cream:        #f5e6c8;
  --cream-dark:   #d4b896;
  --red:          #8b1a1a;
  --red-bright:   #cc2200;
  --text-light:   #f0d9b5;
  --text-dim:     #a08060;
}

html, body {
  width: 720px;
  height: 720px;
  overflow: hidden;
  background: var(--brown-dark);
  color: var(--text-light);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 14px;
  user-select: none;
  -webkit-user-select: none;
}

/* ── Join Screen ── */
#join-screen {
  width: 720px;
  height: 720px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at center, #3d1f00 0%, #1a0a00 70%);
}

#join-box {
  text-align: center;
  padding: 40px;
  background: rgba(0,0,0,0.5);
  border: 2px solid var(--gold);
  border-radius: 8px;
  width: 400px;
}

#join-box h1 {
  font-family: 'Rye', serif;
  font-size: 42px;
  color: var(--gold);
  text-shadow: 2px 2px 8px rgba(0,0,0,0.8);
  line-height: 1.15;
  margin-bottom: 12px;
}

#join-subtitle {
  color: var(--text-dim);
  font-style: italic;
  margin-bottom: 28px;
  font-size: 15px;
}

#name-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 18px;
  font-family: Georgia, serif;
  background: var(--brown-dark);
  border: 1px solid var(--gold);
  color: var(--cream);
  border-radius: 4px;
  margin-bottom: 16px;
  text-align: center;
  outline: none;
}

#name-input::placeholder { color: var(--text-dim); }
#name-input:focus { border-color: var(--gold-light); box-shadow: 0 0 8px rgba(200,168,75,0.3); }

#join-btn {
  width: 100%;
  padding: 14px;
  font-family: 'Rye', serif;
  font-size: 20px;
  background: var(--gold);
  color: var(--brown-dark);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
}

#join-btn:hover  { background: var(--gold-light); }
#join-btn:active { background: var(--brown-light); color: var(--cream); }

#join-error {
  color: var(--red-bright);
  margin-top: 12px;
  font-size: 13px;
  min-height: 18px;
}

/* ── Game Screen Layout ── */
#game-screen {
  width: 720px;
  height: 720px;
  display: flex;
  flex-direction: column;
  background:
    repeating-linear-gradient(90deg, transparent, transparent 60px, rgba(255,255,255,0.01) 60px, rgba(255,255,255,0.01) 61px),
    repeating-linear-gradient(0deg,  transparent, transparent 60px, rgba(255,255,255,0.01) 60px, rgba(255,255,255,0.01) 61px),
    linear-gradient(160deg, #2a1200 0%, #1a0a00 50%, #120800 100%);
}

/* ── Opponents Area ── */
#opponents-area {
  height: 148px;
  display: flex;
  align-items: stretch;
  gap: 0;
  border-bottom: 1px solid rgba(200,168,75,0.2);
  padding: 6px 4px 4px;
  gap: 4px;
}

.opponent-panel {
  flex: 1;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(200,168,75,0.25);
  border-radius: 6px;
  padding: 6px 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: relative;
  transition: border-color 0.2s, background 0.2s;
}

.opponent-panel.active-player {
  border-color: var(--gold);
  background: rgba(200,168,75,0.1);
  box-shadow: 0 0 10px rgba(200,168,75,0.2);
}

.opponent-panel.folded {
  opacity: 0.4;
}

.opponent-panel.eliminated {
  opacity: 0.2;
}

.opp-name {
  font-family: 'Rye', serif;
  font-size: 13px;
  color: var(--gold);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.opp-chips {
  font-size: 14px;
  color: var(--text-light);
}

.opp-bet {
  font-size: 13px;
  color: var(--gold-light);
  min-height: 16px;
}

.opp-cards {
  display: flex;
  gap: 3px;
  margin-top: 2px;
}

.opp-badges {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ── Table Area ── */
#table-area {
  height: 200px;
  background: var(--felt);
  border-top: 2px solid rgba(200,168,75,0.3);
  border-bottom: 2px solid rgba(200,168,75,0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: relative;
}

#table-area::before {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(200,168,75,0.15);
  border-radius: 50%;
  pointer-events: none;
}

#community-cards {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

#table-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

#pot-display {
  font-family: 'Rye', serif;
  font-size: 20px;
  color: var(--gold);
  letter-spacing: 1px;
}

#last-action-display {
  font-size: 15px;
  color: var(--text-dim);
  font-style: italic;
  text-align: center;
  min-height: 19px;
  padding: 0 16px;
}

/* ── My Area ── */
#my-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 12px 12px;
  gap: 8px;
}

#my-info {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

#my-name-display {
  font-family: 'Rye', serif;
  font-size: 20px;
  color: var(--gold);
}

#my-chips-display {
  font-size: 18px;
  color: var(--text-light);
}

#my-status-badges {
  display: flex;
  gap: 4px;
}

#my-hole-cards {
  display: flex;
  gap: 12px;
  justify-content: center;
}

#action-area {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  margin-top: 4px;
}

/* ── Cards ── */
.card {
  width: 52px;
  height: 74px;
  background: var(--cream);
  border: 1px solid #bba070;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: #111;
  line-height: 1;
  box-shadow: 1px 2px 6px rgba(0,0,0,0.5);
  position: relative;
  flex-shrink: 0;
}

.card .rank {
  font-size: 22px;
  font-family: Georgia, serif;
}

.card .suit {
  font-size: 20px;
  margin-top: 2px;
}

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

.card.card-back {
  background: repeating-linear-gradient(
    45deg,
    #8b1a1a 0px, #8b1a1a 4px,
    #5a0a0a 4px, #5a0a0a 8px
  );
  border-color: #5a0a0a;
}

.card.card-back::after {
  content: '★';
  color: rgba(255,200,100,0.5);
  font-size: 22px;
}

.card.community {
  width: 76px;
  height: 108px;
}

.card.community .rank { font-size: 30px; }
.card.community .suit { font-size: 26px; margin-top: 3px; }

.card.community.empty {
  background: rgba(0,0,0,0.2);
  border: 1px dashed rgba(200,168,75,0.2);
  box-shadow: none;
}

.card.my-card {
  width: 100px;
  height: 144px;
}

.card.my-card .rank { font-size: 40px; }
.card.my-card .suit { font-size: 34px; margin-top: 6px; }

.card.my-card .corner-rank {
  position: absolute;
  top: 6px;
  left: 8px;
  font-size: 15px;
  font-family: Georgia, serif;
  font-weight: bold;
  line-height: 1;
}

/* ── Badges ── */
.badge {
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.badge-dealer  { background: var(--gold);    color: var(--brown-dark); }
.badge-sb      { background: #4a7a4a;        color: var(--cream); }
.badge-bb      { background: #2a5a8a;        color: var(--cream); }
.badge-allin   { background: var(--red);     color: var(--cream); }
.badge-folded  { background: #444;           color: #888; }

/* ── Action Buttons ── */
.action-btn {
  padding: 16px 22px;
  font-family: 'Rye', serif;
  font-size: 18px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.1s;
  min-width: 130px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

.btn-fold  { background: #5a1a1a; color: var(--cream); }
.btn-fold:hover  { background: #7a2a2a; }
.btn-fold:active { background: #3a0a0a; }

.btn-check { background: #3a5a3a; color: var(--cream); }
.btn-check:hover  { background: #4a7a4a; }
.btn-check:active { background: #2a3a2a; }

.btn-call  { background: #2a4a6a; color: var(--cream); }
.btn-call:hover  { background: #3a5a8a; }
.btn-call:active { background: #1a2a4a; }

.btn-raise { background: var(--gold); color: var(--brown-dark); }
.btn-raise:hover  { background: var(--gold-light); }
.btn-raise:active { background: var(--brown-light); color: var(--cream); }

.btn-dealer {
  background: var(--gold);
  color: var(--brown-dark);
  font-size: 17px;
  min-width: 200px;
  padding: 16px 24px;
}
.btn-dealer:hover  { background: var(--gold-light); }
.btn-dealer:active { transform: scale(0.97); }

.waiting-msg {
  color: var(--text-dim);
  font-style: italic;
  font-size: 14px;
  padding: 10px;
}

/* ── Raise Modal ── */
#raise-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
}

#raise-box {
  background: var(--brown-mid);
  border: 2px solid var(--gold);
  border-radius: 8px;
  padding: 24px;
  width: 360px;
  text-align: center;
}

#raise-label {
  font-family: 'Rye', serif;
  font-size: 18px;
  color: var(--gold);
  margin-bottom: 16px;
}

#raise-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.raise-opt-btn {
  padding: 14px 10px;
  font-family: 'Rye', serif;
  font-size: 14px;
  background: var(--felt);
  border: 1px solid var(--gold);
  color: var(--cream);
  border-radius: 4px;
  cursor: pointer;
}
.raise-opt-btn:hover  { background: var(--felt-light); }
.raise-opt-btn:active { background: var(--brown-dark); }

#raise-cancel {
  background: none;
  border: 1px solid var(--text-dim);
  color: var(--text-dim);
  padding: 10px 28px;
  font-family: Georgia, serif;
  font-size: 14px;
  border-radius: 4px;
  cursor: pointer;
}
#raise-cancel:hover { border-color: var(--cream); color: var(--cream); }

/* ── End Screen ── */
#end-screen {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 600;
}

#end-box {
  text-align: center;
  padding: 40px;
}

#end-title {
  font-family: 'Rye', serif;
  font-size: 48px;
  color: var(--gold);
  text-shadow: 2px 2px 12px rgba(0,0,0,0.9);
  margin-bottom: 16px;
}

#end-subtitle {
  font-size: 18px;
  color: var(--text-dim);
  font-style: italic;
}

/* ── Blood Overlay ── */
#blood-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 900;
  opacity: 0;
  transition: opacity 0.8s ease;
  /* Drip/splatter look via radial + SVG filter */
  background: radial-gradient(ellipse at 50% 120%, rgba(180,0,0,0.0) 30%, rgba(180,0,0,0.9) 100%);
}

/* ── Error Toast ── */
#error-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(120,0,0,0.9);
  color: var(--cream);
  padding: 10px 22px;
  border-radius: 5px;
  font-size: 14px;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  white-space: nowrap;
}

#error-toast.show { opacity: 1; }

/* ── Waiting overlay ── */
#waiting-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 400;
}

#waiting-box {
  text-align: center;
  padding: 32px 48px;
  background: rgba(0,0,0,0.7);
  border: 1px solid var(--gold);
  border-radius: 8px;
}

#waiting-box h2 {
  font-family: 'Rye', serif;
  font-size: 22px;
  color: var(--gold);
  margin-bottom: 10px;
}

#waiting-box p {
  color: var(--text-dim);
  font-style: italic;
}

/* ── Showdown result banner ── */
#showdown-banner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.85);
  border: 2px solid var(--gold);
  border-radius: 6px;
  padding: 10px 20px;
  text-align: center;
  z-index: 300;
  pointer-events: none;
}

#showdown-banner p {
  font-family: 'Rye', serif;
  font-size: 15px;
  color: var(--gold);
}
