:root {
  --felt: #0f5132;
  --felt-dark: #0a3a24;
  --felt-light: #17703f;
  --ink: #e9f2ec;
  --muted: #8fb3a0;
  --gold: #f0c674;
  --red: #d64545;
  --blue: #3d7dff;
  --panel: #16221c;
  --panel-2: #1d2c24;
  --line: #2b3d33;
}

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

html, body {
  height: 100%;
  background: #0a1410;
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", system-ui, sans-serif;
  overflow: hidden;
}

.hidden { display: none !important; }

/* ------------------------------------------------------------ 登录 ---- */

.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 30%, #14472f 0%, #071009 70%);
  z-index: 50;
}

.login-card {
  width: min(360px, 90vw);
  padding: 32px 28px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
  text-align: center;
}

.login-card h1 { font-size: 30px; letter-spacing: 2px; color: var(--gold); }
.login-card .subtitle { margin: 8px 0 24px; color: var(--muted); font-size: 13px; }

.login-card label {
  display: block;
  text-align: left;
  font-size: 12px;
  color: var(--muted);
  margin: 12px 0 6px;
}

.login-card input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0e1713;
  color: var(--ink);
  font-size: 15px;
  outline: none;
}

.login-card input:focus { border-color: var(--gold); }

.login-card button {
  width: 100%;
  margin-top: 22px;
  padding: 12px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(180deg, #d9a94c, #b8842c);
  color: #23180a;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.login-card button:hover { filter: brightness(1.08); }

.error { margin-top: 12px; color: #ff8080; font-size: 13px; min-height: 18px; }

/* ---------------------------------------------------------- 顶栏 ------ */

.app { display: flex; flex-direction: column; height: 100%; }

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 18px;
  background: #0d1813;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}

.brand { color: var(--gold); font-weight: 700; font-size: 17px; }

.table-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 13px;
  flex: 1;
}

.street-chip {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--ink);
  border: 1px solid var(--line);
}

.ghost-btn {
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
}

.ghost-btn:hover { color: var(--ink); border-color: var(--muted); }

/* ---------------------------------------------------------- 布局 ------ */

.layout { display: flex; flex: 1; min-height: 0; }

.felt-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  min-width: 0;
}

.felt {
  position: relative;
  width: min(100%, 940px);
  aspect-ratio: 16 / 9;
  max-height: 100%;
  border-radius: 220px / 160px;
  background:
    radial-gradient(ellipse at 50% 45%, var(--felt-light), var(--felt) 55%, var(--felt-dark) 100%);
  border: 12px solid #2a1d12;
  box-shadow: inset 0 0 80px rgba(0, 0, 0, .45), 0 20px 50px rgba(0, 0, 0, .5);
}

.seats { position: absolute; inset: 0; }

/* ---------------------------------------------------------- 座位 ------ */

.seat {
  position: absolute;
  width: 132px;
  transform: translate(-50%, -50%);
  padding: 7px 9px;
  border-radius: 10px;
  background: rgba(9, 20, 14, .82);
  border: 1px solid var(--line);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .45);
  font-size: 12px;
  transition: border-color .18s, box-shadow .18s, opacity .18s;
}

.seat.is-turn {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(240, 198, 116, .35), 0 6px 18px rgba(0, 0, 0, .5);
}

.seat.is-folded { opacity: .42; }
.seat.is-me { border-color: var(--blue); }

.seat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.seat-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 84px;
}

.seat-name .tag {
  font-size: 10px;
  color: var(--muted);
  font-weight: 400;
}

.seat-stack { color: var(--gold); font-variant-numeric: tabular-nums; }

.seat-cards { display: flex; gap: 3px; margin-top: 5px; min-height: 26px; }
.seat-cards .mini-card { width: 20px; height: 28px; font-size: 11px; }

.seat-bet {
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translate(-50%, 8px);
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(240, 198, 116, .16);
  color: var(--gold);
  border: 1px solid rgba(240, 198, 116, .4);
  font-size: 11px;
  white-space: nowrap;
}

.seat-badge {
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translate(-50%, 8px);
  font-size: 10px;
  color: var(--muted);
}

.dealer-btn {
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #f3f3f3;
  color: #222;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #999;
}

.seat-wrap { position: absolute; transform: translate(-50%, -50%); }

/* ---------------------------------------------------------- 牌桌中心 -- */

.table-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 62%;
}

.board { display: flex; gap: 8px; min-height: 84px; }

.card {
  width: 54px;
  height: 76px;
  border-radius: 6px;
  background: linear-gradient(180deg, #fdfdfb, #e9e7e0);
  color: #1a1a1a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 19px;
  line-height: 1;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .45);
  border: 1px solid #cfcbc0;
}

.card.red { color: #c62828; }
.card.mini-card { width: 20px; height: 28px; font-size: 11px; border-radius: 3px; }
.card.placeholder { background: rgba(255, 255, 255, .07); border: 1px dashed rgba(255,255,255,.22); box-shadow: none; }
.card.back { background: repeating-linear-gradient(45deg, #1e4a8a, #1e4a8a 5px, #17396e 5px, #17396e 10px); border-color: #0f2a55; }

.pot-line { display: flex; align-items: baseline; gap: 10px; }
.pot-label { color: var(--muted); font-size: 12px; }
.pot-size { color: var(--gold); font-size: 25px; font-weight: 700; font-variant-numeric: tabular-nums; }

.pot-layers { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

.pot-layer {
  font-size: 11px;
  color: var(--muted);
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, .25);
}

/* ---------------------------------------------------------- 侧栏 ------ */

.sidebar {
  width: 268px;
  flex: 0 0 auto;
  border-left: 1px solid var(--line);
  background: #0c1510;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.panel { border-bottom: 1px solid var(--line); padding: 12px 14px; }
.panel-title { font-size: 12px; color: var(--muted); margin-bottom: 9px; letter-spacing: 1px; }

.my-cards { display: flex; gap: 8px; min-height: 76px; }

.log-panel { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.log { flex: 1; overflow-y: auto; font-size: 12px; line-height: 1.75; }
.log-line { color: var(--muted); }
.log-line b { color: var(--ink); font-weight: 600; }
.log-line .act-fold { color: #e08a8a; }
.log-line .act-call { color: #9ec9ff; }
.log-line .act-raise { color: var(--gold); }
.log-line .act-check { color: #9fd7b4; }
.log-line .head { color: var(--gold); }
.log-line .win { color: #ffd76e; }

/* ---------------------------------------------------------- 操作栏 ---- */

.actionbar {
  flex: 0 0 auto;
  border-top: 1px solid var(--line);
  background: #0d1813;
  padding: 10px 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.action-status { font-size: 13px; color: var(--muted); min-height: 19px; }
.action-status b { color: var(--gold); }

.action-buttons { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.act-btn {
  padding: 11px 22px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
  transition: filter .15s, opacity .15s;
}

.act-btn:disabled { opacity: .28; cursor: not-allowed; }
.act-btn:not(:disabled):hover { filter: brightness(1.12); }

.act-btn.fold { background: #5a3030; }
.act-btn.check { background: #2c4a3a; }
.act-btn.call { background: #2f5ea8; }
.act-btn.raise { background: #b8842c; color: #23180a; }

.raise-group { display: flex; align-items: center; gap: 9px; }
.raise-group input[type=range] { width: 220px; accent-color: var(--gold); }
.raise-group output { color: var(--gold); font-weight: 700; min-width: 66px; font-variant-numeric: tabular-nums; }

.quick-raises { display: flex; gap: 7px; flex-wrap: wrap; }

.quick-raises button {
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

.quick-raises button:hover:not(:disabled) { color: var(--ink); border-color: var(--gold); }
.quick-raises button:disabled { opacity: .3; cursor: not-allowed; }

/* ---------------------------------------------------------- 提示 ------ */

.toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%) translateY(14px);
  padding: 10px 20px;
  border-radius: 8px;
  background: rgba(20, 32, 25, .96);
  border: 1px solid var(--gold);
  color: var(--gold);
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s, transform .22s;
  z-index: 40;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .felt { aspect-ratio: 1 / 1; }
  .seat { width: 108px; font-size: 11px; }
}
