/* ===== 基础重置 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0f1117;
  --bg2:       #1a1d26;
  --bg3:       #242736;
  --border:    #2e3347;
  --accent:    #c8a84b;   /* 金色 */
  --accent2:   #e2c97e;
  --green:     #3dba7e;
  --red:       #e05c5c;
  --blue:      #5b9cf6;
  --text:      #e8eaf0;
  --text2:     #9299b0;
  --text3:     #5a6180;
  --radius:    8px;
  --radius-lg: 14px;
  --shadow:    0 4px 24px rgba(0,0,0,.45);
}

html { font-size: 15px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", sans-serif;
  line-height: 1.55;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent2); }

/* ===== 导航栏 ===== */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.navbar-brand {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  display: flex; align-items: center; gap: 8px;
}
.navbar-brand svg { width:22px; height:22px; }
.navbar-nav { display: flex; gap: 6px; align-items: center; }
.navbar-nav a {
  padding: 5px 12px;
  border-radius: var(--radius);
  color: var(--text2);
  font-size: .88rem;
  transition: background .15s, color .15s;
}
.navbar-nav a:hover, .navbar-nav a.active {
  background: var(--bg3);
  color: var(--text);
}
.nav-user {
  display: flex; align-items: center; gap: 8px;
  font-size: .85rem; color: var(--text2);
}
.nav-user .avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .8rem;
}

/* ===== 布局容器 ===== */
.container { max-width: 1100px; margin: 0 auto; padding: 28px 20px; }
.container-sm { max-width: 680px; margin: 0 auto; padding: 28px 20px; }

/* ===== 卡片 ===== */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
}
.card + .card { margin-top: 16px; }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius);
  font-size: .88rem; font-weight: 600;
  border: none; cursor: pointer;
  transition: filter .15s, opacity .15s;
  white-space: nowrap;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:not(:disabled):hover { filter: brightness(1.12); }
.btn-primary { background: var(--accent); color: var(--bg); }
.btn-success { background: var(--green); color: #fff; }
.btn-danger  { background: var(--red);   color: #fff; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text2);
}
.btn-ghost:not(:disabled):hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: 5px 12px; font-size: .82rem; }
.btn-lg { padding: 11px 28px; font-size: 1rem; }
.btn-block { width: 100%; }

/* ===== 表单 ===== */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  margin-bottom: 6px;
  font-size: .85rem; color: var(--text2); font-weight: 500;
}
.form-control {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 9px 12px;
  font-size: .9rem;
  transition: border-color .15s;
  outline: none;
}
.form-control:focus { border-color: var(--accent); }
.form-control::placeholder { color: var(--text3); }
select.form-control option { background: var(--bg3); }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-hint { font-size: .78rem; color: var(--text3); margin-top: 4px; }

/* ===== 徽章/状态 ===== */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 9px; border-radius: 20px;
  font-size: .75rem; font-weight: 600;
}
.badge-pending  { background: rgba(91,156,246,.18); color: var(--blue); }
.badge-running  { background: rgba(61,186,126,.18); color: var(--green); }
.badge-finished { background: rgba(90,97,128,.25);  color: var(--text3); }
.badge-cancelled{ background: rgba(224,92,92,.18);  color: var(--red); }

/* ===== 赛事列表卡片 ===== */
.tournament-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  display: flex; gap: 20px; align-items: flex-start;
  transition: border-color .2s;
}
.tournament-card:hover { border-color: var(--accent); }
.tournament-card + .tournament-card { margin-top: 12px; }
.tc-main { flex: 1; min-width: 0; }
.tc-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 6px; }
.tc-meta {
  display: flex; flex-wrap: wrap; gap: 10px 20px;
  font-size: .82rem; color: var(--text2); margin-bottom: 8px;
}
.tc-meta span { display: flex; align-items: center; gap: 4px; }
.tc-prize {
  font-size: .82rem;
  background: rgba(200,168,75,.1);
  border: 1px solid rgba(200,168,75,.2);
  border-radius: 6px;
  padding: 5px 10px;
  color: var(--accent2);
  margin-top: 6px;
  display: inline-block;
}
.tc-action { flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }

/* ===== 对局桌面 ===== */
.table-room {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: calc(100vh - 56px);
  padding: 16px;
  gap: 12px;
}
.felt {
  background: radial-gradient(ellipse at center, #1a4a2e 0%, #0f2e1b 100%);
  border: 3px solid #2d6b42;
  border-radius: 50%;
  aspect-ratio: 2.1 / 1;
  position: relative;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px;
  box-shadow: 0 0 60px rgba(0,80,30,.4), inset 0 0 40px rgba(0,0,0,.3);
  margin: 0 auto;
  width: 100%;
  max-width: 820px;
}
.community-cards {
  display: flex; gap: 8px;
  align-items: center; justify-content: center;
}
.pot-info { color: var(--accent); font-weight: 700; font-size: 1rem; text-align: center; }
.street-label {
  font-size: .78rem; color: var(--text2); text-transform: uppercase; letter-spacing: .05em;
}

/* 扑克牌 */
.card-face {
  width: 52px; height: 74px;
  background: #fff;
  border-radius: 7px;
  border: 1px solid #ddd;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; font-weight: 700;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
  user-select: none;
  flex-shrink: 0;
}
.card-face.red  { color: #e02020; }
.card-face.black{ color: #111; }
.card-back {
  width: 52px; height: 74px;
  background: linear-gradient(135deg, #1a3a6e, #0d1f40);
  border-radius: 7px;
  border: 2px solid #2a4a8e;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
  flex-shrink: 0;
}
.card-sm .card-face, .card-sm .card-back { width: 38px; height: 54px; font-size: 1rem; }

/* 座位 */
.seats-wrap {
  position: absolute; inset: 0;
  pointer-events: none;
}
.seat {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center;
  gap: 4px;
  pointer-events: auto;
  min-width: 86px;
}
.seat-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--bg3);
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 700;
  transition: border-color .2s;
  position: relative;
}
.seat.active-turn .seat-avatar { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(200,168,75,.3); }
.seat.is-me .seat-avatar { border-color: var(--blue); }
.seat.folded .seat-avatar { opacity: .4; }
.seat.eliminated .seat-avatar { opacity: .2; }
.dealer-btn {
  position: absolute; top: -6px; right: -8px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); color: var(--bg);
  font-size: .6rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.seat-name { font-size: .75rem; color: var(--text2); max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-chips { font-size: .78rem; color: var(--accent); font-weight: 600; }
.seat-bet { font-size: .72rem; color: var(--text3); }
.seat-status-tag {
  font-size: .62rem; padding: 1px 6px; border-radius: 10px;
  font-weight: 600;
}
.seat-status-tag.fold { background: rgba(224,92,92,.18); color: var(--red); }
.seat-status-tag.allin { background: rgba(200,168,75,.18); color: var(--accent); }

/* 操作栏 */
.action-bar {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  max-width: 820px; margin: 0 auto; width: 100%;
}
.action-bar .raise-wrap { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 200px; }
.action-bar input[type=range] { flex: 1; accent-color: var(--accent); }
.action-bar .raise-val { font-size: .88rem; color: var(--accent); font-weight: 600; min-width: 54px; }
.waiting-msg { color: var(--text3); font-size: .88rem; }

/* 手牌区（玩家自己的） */
.my-hand {
  display: flex; gap: 8px; justify-content: center; align-items: center;
}

/* 信息侧栏 */
.game-info { font-size: .82rem; color: var(--text2); display: flex; gap: 16px; flex-wrap: wrap; }
.game-info span { display: flex; align-items: center; gap: 4px; }

/* ===== 对局日志 ===== */
.event-log {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  max-height: 160px;
  overflow-y: auto;
  font-size: .78rem; color: var(--text2);
  max-width: 820px; margin: 0 auto; width: 100%;
}
.event-log p { padding: 2px 0; border-bottom: 1px solid rgba(255,255,255,.04); }
.event-log p:last-child { border-bottom: none; }
.ev-win { color: var(--green); }
.ev-elim { color: var(--red); }
.ev-info { color: var(--blue); }

/* ===== 排行榜 ===== */
.ranking-table { width: 100%; border-collapse: collapse; }
.ranking-table th, .ranking-table td {
  padding: 9px 14px; text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: .88rem;
}
.ranking-table th { color: var(--text2); font-weight: 600; font-size: .8rem; }
.ranking-table tr:last-child td { border-bottom: none; }
.rank-1 td:first-child { color: var(--accent); }
.rank-2 td:first-child { color: #c0c0c0; }
.rank-3 td:first-child { color: #cd7f32; }

/* ===== 空状态 ===== */
.empty-state {
  text-align: center; padding: 48px 20px; color: var(--text3);
}
.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: .4; }
.empty-state p { font-size: .9rem; }

/* ===== 提示 toast ===== */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 9999;
}
.toast {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: .85rem;
  box-shadow: var(--shadow);
  max-width: 320px;
  animation: slideIn .2s ease;
}
.toast.success { border-color: var(--green); color: var(--green); }
.toast.error   { border-color: var(--red);   color: var(--red); }
.toast.info    { border-color: var(--blue);  color: var(--blue); }
@keyframes slideIn { from { opacity:0; transform:translateX(16px); } to { opacity:1; transform:none; } }

/* ===== 模态框 ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 500;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  width: 100%; max-width: 480px;
  box-shadow: var(--shadow);
}
.modal-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

/* ===== 进度/计时 ===== */
.timer-bar-wrap {
  width: 100%; height: 4px;
  background: var(--bg3);
  border-radius: 2px; overflow: hidden;
  margin-top: 4px;
}
.timer-bar {
  height: 100%;
  background: var(--accent);
  transition: width 1s linear;
}
.timer-bar.urgent { background: var(--red); }

/* ===== 盲注结构显示 ===== */
.blind-row {
  display: flex; gap: 10px; align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: .85rem;
}
.blind-row:last-child { border-bottom: none; }
.blind-lvl { color: var(--text2); font-size: .78rem; min-width: 44px; }
.blind-add-btn {
  background: none; border: 1px dashed var(--border);
  color: var(--text3); padding: 6px; border-radius: 6px;
  cursor: pointer; font-size: .82rem; width: 100%;
  transition: border-color .15s, color .15s;
}
.blind-add-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ===== 响应式 ===== */
@media (max-width: 640px) {
  .navbar { padding: 0 14px; }
  .container, .container-sm { padding: 16px 12px; }
  .tournament-card { flex-direction: column; }
  .tc-action { width: 100%; flex-direction: row; justify-content: flex-end; }
  .felt { aspect-ratio: 1.4 / 1; }
  .card-face { width: 42px; height: 60px; font-size: 1.1rem; }
  .action-bar { padding: 10px 12px; }
}

/* ===== 通用工具 ===== */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-3 { margin-bottom: 12px; }
.text-sm { font-size: .82rem; }
.text-muted { color: var(--text2); }
.text-accent { color: var(--accent); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.fw-bold { font-weight: 700; }
.section-title {
  font-size: 1.1rem; font-weight: 700;
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 10px;
}
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
