* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: #1d3124;
  color: #f0ead6;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  background: #14231a;
  border-bottom: 2px solid #0d1811;
  flex-wrap: wrap;
}

.topbar h1 {
  margin: 0;
  font-size: 20px;
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar-controls input {
  padding: 6px 8px;
  border-radius: 4px;
  border: 1px solid #3c5a46;
  background: #f0ead6;
}

.auth-area {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.auth-link {
  text-decoration: none;
}

.auth-google {
  background: #ffffff;
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background: #14231a;
  border: 1px solid #3c5a46;
  flex: 0 0 auto;
}

.avatar-lg {
  width: 72px;
  height: 72px;
}

.avatar-sm {
  width: 24px;
  height: 24px;
}

.name-with-avatar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-input {
  width: 110px;
}

.auth-btn {
  padding: 6px 12px;
  border: none;
  border-radius: 5px;
  background: #f0ead6;
  color: #1d3124;
  font-weight: 700;
  cursor: pointer;
}

.auth-btn:hover { filter: brightness(1.1); }
.auth-signup { background: #9be89b; }

.auth-user {
  font-weight: 700;
  color: #ffd97a;
}

.auth-balance {
  color: #9be89b;
  font-weight: 600;
}

.auth-refill {
  font-size: 12px;
  color: #b8e0ff;
}

.seat-hint {
  font-size: 12px;
  color: #9db8a6;
  font-style: italic;
}

.stand-btn {
  margin-top: 4px;
  align-self: flex-start;
  padding: 4px 10px;
  border: 1px solid #3c5a46;
  border-radius: 5px;
  background: transparent;
  color: #9db8a6;
  font-size: 12px;
  cursor: pointer;
}

.stand-btn:hover {
  color: #f0ead6;
  border-color: #9db8a6;
}

.history-link {
  color: #ffd97a;
}

.conn-status {
  font-size: 12px;
  opacity: 0.8;
}

.conn-status.ok { color: #9be89b; }
.conn-status.bad { color: #ff9b9b; }

.status-line {
  text-align: center;
  padding: 8px;
  min-height: 20px;
  font-size: 15px;
  color: #ffd97a;
}

/* ------------------------------------------------------------- table grid */

.table-area {
  display: grid;
  grid-template-columns: 1fr 1.1fr 1.1fr 1.1fr 1fr;
  grid-template-rows: auto auto auto;
  grid-template-areas:
    ".       seat-t1 seat-t2 seat-t3 ."
    "seat-l  center  center  center  seat-r"
    ".       seat-b1 seat-b2 seat-b3 .";
  gap: 12px;
  padding: 14px;
  max-width: 1250px;
  margin: 0 auto;
}

/* ------------------------------------------------------------------ seats */

.seat {
  position: relative;
  border: 2px solid #3c5a46;
  border-radius: 10px;
  background: #24402f;
  padding: 10px;
  min-height: 130px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.seat.open-seat {
  align-items: center;
  justify-content: center;
  border-style: dashed;
  color: #9db8a6;
}

.seat.your-seat {
  border-color: #ffd97a;
  background: #2c4a37;
}

.seat.has-turn {
  border-color: #7ad0ff;
  box-shadow: 0 0 12px rgba(122, 208, 255, 0.5);
}

.seat.folded {
  opacity: 0.55;
}

.turn-banner {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  background: #7ad0ff;
  color: #10222c;
  font-weight: 700;
  font-size: 12px;
  padding: 3px 12px;
  border-radius: 12px;
  white-space: nowrap;
  z-index: 2;
}

.turn-banner.your-turn {
  background: #ffd97a;
  color: #3a2c07;
}

.seat-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.seat-kind {
  font-size: 11px;
  font-weight: 400;
  background: #14231a;
  border-radius: 8px;
  padding: 1px 8px;
  color: #9db8a6;
}

.dealer-chip {
  background: #f0ead6;
  color: #1d3124;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.seat-stack {
  font-size: 14px;
  color: #9be89b;
}

.seat-status {
  font-size: 12px;
  color: #ffd97a;
}

.seat-cards {
  display: flex;
  gap: 5px;
}

.hand-value {
  font-size: 12px;
  color: #b8e0ff;
  font-style: italic;
}

.seat-score {
  font-size: 13px;
  font-weight: 700;
  color: #b8e0ff;
}

.seat-score.winner {
  color: #ffd97a;
}

.sit-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  background: #ffd97a;
  color: #3a2c07;
  font-weight: 700;
  cursor: pointer;
}

.sit-btn:hover { background: #ffe9ad; }

/* ------------------------------------------------------------------ cards */

.card {
  width: 42px;
  height: 60px;
  border-radius: 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.card-face {
  background: #fdfdf6;
  border: 1px solid #999;
}

.card-face.red { color: #c22; }
.card-face.black { color: #222; }

.card-rank { font-size: 16px; line-height: 1; }
.card-suit { font-size: 18px; line-height: 1; }

.card-back {
  background: repeating-linear-gradient(45deg, #37538f, #37538f 4px, #2a4173 4px, #2a4173 8px);
  border: 1px solid #1d2c4e;
}

/* ----------------------------------------------------------------- center */

.center-area {
  border: 3px solid #4a6b55;
  border-radius: 60px;
  background: #2a4a35;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 18px;
  text-align: center;
}

.stage-label {
  font-size: 20px;
  font-weight: 700;
  color: #ffd97a;
}

.pot-label {
  font-size: 18px;
  color: #9be89b;
}

.hand-number {
  font-size: 12px;
  opacity: 0.7;
}

.cut-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.cut-label {
  font-size: 12px;
  color: #b8e0ff;
}

.center-turn {
  font-size: 15px;
  font-weight: 600;
  color: #7ad0ff;
}

.center-turn.your-turn {
  color: #ffd97a;
}

.center-hint {
  color: #9db8a6;
}

.big-btn {
  padding: 12px 28px;
  font-size: 17px;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.start-btn { background: #9be89b; color: #143318; }
.start-btn:hover { background: #c2f5c2; }
.next-btn { background: #7ad0ff; color: #10222c; }
.next-btn:hover { background: #ace2ff; }

/* --------------------------------------------------------------- showdown */

.showdown-panel {
  background: #14231a;
  border-radius: 10px;
  padding: 10px 16px;
  max-width: 420px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.showdown-title {
  font-size: 15px;
  font-weight: 700;
  color: #ffd97a;
}

.showdown-payout {
  color: #9be89b;
}

/* ---------------------------------------------------------------- actions */

.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  border-top: 1px solid #3c5a46;
  padding-top: 8px;
}

.action-btn {
  padding: 7px 12px;
  border: none;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  background: #f0ead6;
  color: #1d3124;
}

.action-btn:hover { filter: brightness(1.1); }

.action-fold { background: #e8a0a0; }
.action-check { background: #b8e0ff; }
.action-call { background: #9be89b; }
.action-bet, .action-raise { background: #ffd97a; }
.action-all-in { background: #ff9b6b; }

.bet-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.bet-amount {
  width: 70px;
  padding: 6px;
  border-radius: 4px;
  border: 1px solid #3c5a46;
}

.bet-range {
  font-size: 11px;
  opacity: 0.7;
}

/* ------------------------------------------------------------------ toast */

.error-toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #a33;
  color: #fff;
  padding: 10px 22px;
  border-radius: 8px;
  font-weight: 600;
  z-index: 10;
}

.hidden {
  display: none !important;
}

/* ---------------------------------------------------------------- history */

.history-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  background: #24402f;
  border-radius: 8px;
  overflow: hidden;
}

.history-table th,
.history-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid #3c5a46;
}

.history-table th {
  background: #14231a;
  color: #ffd97a;
}

.history-table tr.clickable { cursor: pointer; }
.history-table tr.clickable:hover { background: #2c4a37; }

.hand-detail {
  background: #14231a;
  border-radius: 8px;
  padding: 14px;
  margin-top: 14px;
  font-size: 14px;
}

.hand-detail h3 {
  margin-top: 0;
  color: #ffd97a;
}

.hand-detail .detail-cards {
  display: flex;
  gap: 5px;
  margin: 4px 0;
}

.back-link {
  color: #ffd97a;
}

.menu-link {
  color: #ffd97a;
  font-weight: 600;
}

/* ------------------------------------------------------------- menu page */

.menu-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px;
}

.login-panel {
  max-width: 340px;
  margin: 60px auto 0;
  background: #24402f;
  border: 2px solid #3c5a46;
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.login-title {
  margin: 0 0 6px;
  color: #ffd97a;
  font-size: 20px;
  text-align: center;
}

.login-input {
  width: 100%;
  font-size: 15px;
}

.login-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.login-hint {
  font-size: 12px;
  color: #9db8a6;
  text-align: center;
}

.menu-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.menu-variant-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.menu-variant-title {
  margin: 0;
  font-size: 18px;
  color: #b8e0ff;
  letter-spacing: 0.3px;
}

.menu-welcome {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.menu-username {
  font-size: 26px;
  font-weight: 700;
  color: #ffd97a;
}

.menu-balance {
  font-size: 18px;
  color: #9be89b;
  font-weight: 600;
}

.menu-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

.menu-card {
  display: block;
  background: #24402f;
  border: 2px solid #3c5a46;
  border-radius: 12px;
  padding: 18px;
  color: #f0ead6;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}

.menu-card:hover {
  border-color: #ffd97a;
  background: #2c4a37;
}

.menu-card.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.menu-card-title {
  font-size: 18px;
  font-weight: 700;
  color: #ffd97a;
  margin-bottom: 6px;
}

.menu-card-badge {
  display: inline-block;
  background: #14231a;
  color: #9db8a6;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 10px;
  margin-bottom: 6px;
}

.menu-card-desc {
  font-size: 13px;
  color: #b9cfc0;
}

.menu-links {
  text-align: center;
}

.profile-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px;
}

.profile-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #24402f;
  border: 2px solid #3c5a46;
  border-radius: 12px;
  padding: 24px;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.profile-stat {
  background: #14231a;
  border-radius: 10px;
  padding: 12px;
}

.profile-stat-label {
  color: #9db8a6;
  font-size: 12px;
}

.profile-stat-value {
  color: #ffd97a;
  font-size: 20px;
  font-weight: 700;
}

.profile-avatar-input {
  width: 100%;
  font-size: 14px;
}

.profile-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.leaderboard-section {
  margin-top: 18px;
}

.leaderboard-section h2 {
  margin: 0 0 10px;
  color: #b8e0ff;
  font-size: 18px;
}

.leaderboard-avatar-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.leaderboard-you {
  background: #2c4a37;
  font-weight: 700;
}

.leaderboard-you td {
  color: #ffd97a;
}

/* ------------------------------------------------------------ tournament */

.tourney-bar {
  display: flex;
  justify-content: center;
  gap: 22px;
  flex-wrap: wrap;
  padding: 8px;
  font-size: 14px;
  color: #b8e0ff;
}

.tourney-bar-item {
  font-weight: 600;
}

.tourney-lobby {
  max-width: 560px;
  margin: 40px auto 0;
  background: #24402f;
  border: 2px solid #3c5a46;
  border-radius: 12px;
  padding: 26px;
  text-align: center;
  align-items: center;
}

.tourney-info {
  color: #b9cfc0;
  font-size: 14px;
}

.tourney-registered {
  color: #9be89b;
  font-weight: 700;
}

.tourney-won {
  font-size: 34px;
  font-weight: 800;
  color: #ffd97a;
}

.tourney-back {
  display: inline-block;
  text-decoration: none;
  margin-top: 10px;
}

.spectate-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.spectate-note {
  color: #ffd97a;
}

.menu-link-sep {
  color: #9db8a6;
}

.lobby-variant-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.lobby-active {
  background: #ffd97a;
  color: #3a2c07;
}
