/* ══════════════════════════════════════════════
   POKER – STYLE.CSS
   Dark theme: bg #0F1117, surface #1A1D27, accent #305CDE
   ══════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0F1117;
  --surface:   #1A1D27;
  --surface2:  #22263A;
  --accent:    #305CDE;
  --accent-h:  #4472FF;
  --danger:    #E03C3C;
  --success:   #27C770;
  --neutral:   #3A3F55;
  --text:      #E8EAF6;
  --text-dim:  #7B82A8;
  --red-suit:  #E84040;
  --card-bg:   #FAFAFA;
  --card-back: #1E3A8A;
  --radius:    12px;
  --shadow:    0 4px 24px rgba(0,0,0,0.5);
  --transition: 0.25s ease;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 16px;
  overflow-x: hidden;
}

/* ── SCREENS ──────────────────────────────── */
.screen {
  display: none;
  min-height: 100vh;
  padding: 16px;
}
.screen.active { display: flex; align-items: center; justify-content: center; }
#screen-game.active { display: flex; flex-direction: column; align-items: stretch; }
#screen-gameover.active { display: flex; align-items: center; justify-content: center; }

/* ── START SCREEN ─────────────────────────── */
.start-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 40px 32px;
  text-align: center;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255,255,255,0.06);
}

.logo-suits {
  font-size: 2.4rem;
  letter-spacing: 0.3em;
  margin-bottom: 12px;
  color: var(--accent);
}
.logo-suits span:nth-child(2),
.logo-suits span:nth-child(4) { color: var(--red-suit); }

h1 {
  font-size: clamp(1.8rem, 5vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.subtitle {
  color: var(--text-dim);
  margin-bottom: 24px;
  font-size: 0.95rem;
}

.chip-info {
  background: var(--bg);
  border-radius: 8px;
  padding: 10px 16px;
  margin-bottom: 20px;
  font-size: 0.95rem;
  color: var(--text-dim);
}
.chip-info strong { color: var(--text); }

.high-score-box {
  margin-bottom: 20px;
  font-size: 0.9rem;
  color: var(--text-dim);
  min-height: 20px;
}

.rules-hint {
  margin-top: 14px;
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* ── BUTTONS ──────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 10px 20px;
  transition: background var(--transition), transform 0.1s, opacity var(--transition);
  user-select: none;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.4; pointer-events: none; }

.btn-primary  { background: var(--accent);  color: #fff; }
.btn-primary:hover  { background: var(--accent-h); }
.btn-danger   { background: var(--danger);  color: #fff; }
.btn-danger:hover   { background: #f05555; }
.btn-neutral  { background: var(--neutral); color: var(--text); }
.btn-neutral:hover  { background: #4a5070; }
.btn-accent   { background: var(--success); color: #000; }
.btn-accent:hover   { background: #35dd85; }
.btn-large    { width: 100%; padding: 14px 24px; font-size: 1.05rem; border-radius: 10px; }
.btn-small    { padding: 4px 12px; font-size: 0.85rem; background: var(--surface2); color: var(--text); }
.btn-small:hover { background: var(--neutral); }

/* ── GAME SCREEN LAYOUT ───────────────────── */
#screen-game {
  gap: 10px;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
  padding: 12px 12px 20px;
}

/* ── TOP BAR ──────────────────────────────── */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 16px;
  gap: 10px;
  border: 1px solid rgba(255,255,255,0.06);
}

.player-info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
}
.player-label { color: var(--text-dim); font-size: 0.78rem; white-space: nowrap; }
.chip-count {
  font-weight: 700;
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.chip-icon { font-size: 1rem; }

.pot-display {
  text-align: center;
  background: var(--bg);
  border-radius: 8px;
  padding: 6px 20px;
  min-width: 90px;
}
.pot-label  { font-size: 0.7rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; }
.pot-amount { font-size: 1.3rem; font-weight: 800; color: #FFD700; font-variant-numeric: tabular-nums; }

/* ── STATUS ───────────────────────────────── */
.status-msg {
  background: var(--surface);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.9rem;
  color: var(--text-dim);
  text-align: center;
  border: 1px solid rgba(255,255,255,0.04);
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition);
}
.status-msg.highlight { color: var(--text); }

/* ── COMMUNITY AREA ───────────────────────── */
.community-area {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 12px 10px;
  border: 1px solid rgba(255,255,255,0.06);
}
.community-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
  text-align: center;
}
.round-label {
  text-align: center;
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ── HAND SECTIONS ────────────────────────── */
.hand-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.06);
}
.hand-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
  text-align: center;
}
.hand-name {
  text-align: center;
  margin-top: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--success);
  min-height: 20px;
}

/* ── CARD ROW ─────────────────────────────── */
.card-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── CARD ─────────────────────────────────── */
.card {
  width: 62px;
  height: 90px;
  border-radius: 8px;
  background: var(--card-bg);
  color: #111;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 5px 6px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  position: relative;
  flex-shrink: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: cardDeal 0.3s ease both;
}
@keyframes cardDeal {
  from { transform: translateY(-20px) scale(0.85); opacity: 0; }
  to   { transform: translateY(0) scale(1);        opacity: 1; }
}
.card:hover { transform: translateY(-4px); box-shadow: 0 6px 16px rgba(0,0,0,0.5); }

.card .rank {
  font-size: 1rem;
  line-height: 1;
}
.card .suit-top {
  font-size: 0.85rem;
  line-height: 1;
}
.card .suit-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.8rem;
  opacity: 0.2;
  pointer-events: none;
}
.card.red-card { color: var(--red-suit); }

/* Face-down card */
.card.face-down {
  background: var(--card-back);
  background-image: repeating-linear-gradient(
    45deg,
    rgba(255,255,255,0.04) 0px, rgba(255,255,255,0.04) 2px,
    transparent 2px, transparent 8px
  );
  cursor: default;
}
.card.face-down::after {
  content: "🂠";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.5rem;
  opacity: 0.35;
}

/* Card placeholder */
.card-placeholder {
  width: 62px;
  height: 90px;
  border-radius: 8px;
  border: 2px dashed rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.02);
  flex-shrink: 0;
}

/* Winning card highlight */
.card.winner-card {
  box-shadow: 0 0 0 3px #FFD700, 0 4px 16px rgba(255,215,0,0.4);
  transform: translateY(-6px);
}

/* ── BETTING CONTROLS ─────────────────────── */
.betting-controls {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px;
  border: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.betting-controls.hidden { display: none; }

.bet-info-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  color: var(--text-dim);
}
.bet-info-row strong { color: var(--text); font-variant-numeric: tabular-nums; }

.raise-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--text-dim);
}
.raise-amount {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  min-width: 60px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.action-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 8px;
}
@media (max-width: 380px) {
  .action-buttons { grid-template-columns: 1fr 1fr; }
}

/* ── NEXT CONTROLS ────────────────────────── */
.next-controls {
  padding: 4px 0;
}
.next-controls.hidden { display: none; }

/* ── GAME OVER ────────────────────────────── */
.gameover-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 48px 32px;
  text-align: center;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255,255,255,0.06);
}
.go-trophy { font-size: 4rem; margin-bottom: 12px; }
.gameover-card h2 { font-size: 2rem; font-weight: 800; margin-bottom: 8px; }
.go-subtitle { color: var(--text-dim); margin-bottom: 20px; font-size: 0.95rem; }
.go-highscore {
  background: var(--bg);
  border-radius: 8px;
  padding: 10px 16px;
  margin-bottom: 24px;
  font-size: 0.9rem;
  color: var(--text-dim);
  min-height: 20px;
}
.go-highscore strong { color: #FFD700; }

/* ── UTILITY ──────────────────────────────── */
.hidden { display: none !important; }

/* Flash animations */
@keyframes flashGreen {
  0%, 100% { background: var(--surface); }
  50%       { background: rgba(39,199,112,0.18); }
}
@keyframes flashRed {
  0%, 100% { background: var(--surface); }
  50%       { background: rgba(224,60,60,0.18); }
}
.flash-green { animation: flashGreen 0.5s ease; }
.flash-red   { animation: flashRed   0.5s ease; }

/* Chip count change flash */
@keyframes chipUp {
  0%   { color: var(--text); }
  40%  { color: var(--success); transform: scale(1.2); }
  100% { color: var(--text); transform: scale(1); }
}
@keyframes chipDown {
  0%   { color: var(--text); }
  40%  { color: var(--danger); transform: scale(0.9); }
  100% { color: var(--text); transform: scale(1); }
}
.chip-up   { animation: chipUp   0.5s ease; }
.chip-down { animation: chipDown 0.5s ease; }

/* Responsive tweaks */
@media (max-width: 420px) {
  .card { width: 52px; height: 76px; }
  .card-placeholder { width: 52px; height: 76px; }
  .card .suit-center { font-size: 1.4rem; }
  .top-bar { padding: 10px 10px; }
  .pot-display { padding: 6px 12px; min-width: 70px; }
  .pot-amount { font-size: 1.1rem; }
}

@media (max-width: 340px) {
  .card { width: 44px; height: 64px; padding: 3px 4px; }
  .card-placeholder { width: 44px; height: 64px; }
  .card .rank { font-size: 0.8rem; }
  .card .suit-top { font-size: 0.7rem; }
  .card .suit-center { font-size: 1.1rem; }
}
