* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #1a2f26; color: #eee; overflow: hidden; }
.hidden { display: none !important; }
button { cursor: pointer; user-select: none; }
button:disabled { cursor: not-allowed; opacity: .45; filter: grayscale(.5); }

/* ---------- 登录 ---------- */
#login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, #2e6b4f 0%, #12352a 70%, #0b241c 100%); padding: 16px; }
.login-box { background: rgba(0,0,0,.45); padding: 40px 48px; border-radius: 16px;
  display: flex; flex-direction: column; gap: 14px; width: min(340px, 92vw); text-align: center;
  box-shadow: 0 10px 40px rgba(0,0,0,.5); border: 1px solid #3d8a68; }
.login-box h1 { color: #ffd76e; letter-spacing: 4px; font-size: 30px; }
.login-box .sub { color: #9fd4bb; font-size: 13px; margin-bottom: 8px; }
.login-box input { padding: 12px; border-radius: 8px; border: 1px solid #3d8a68;
  background: #10352a; color: #fff; font-size: 15px; outline: none; }
.login-box input:focus { border-color: #ffd76e; }
.room-row { display: flex; gap: 8px; }
.room-row select {
  padding: 12px 8px; border-radius: 8px; border: 1px solid #3d8a68;
  background: #10352a; color: #ffd76e; font-size: 13px; outline: none;
  flex-shrink: 0; min-width: 130px; cursor: pointer;
}
.room-row select:focus { border-color: #ffd76e; }
.room-row input { flex: 1; min-width: 0; }
.login-box button { padding: 12px; border-radius: 8px; border: none; font-size: 16px; font-weight: bold;
  background: linear-gradient(180deg, #ffd76e, #e0a93e); color: #4a3000; transition: filter .15s; }
.login-box button:hover:not(:disabled) { filter: brightness(1.1); }
.login-box .tip { font-size: 12px; color: #7fb59c; line-height: 1.6; }
.login-box .err { color: #ff9c9c; font-size: 13px; min-height: 1.2em; }

/* ---------- 大厅(房间列表) ---------- */
.lobby { margin-top: 8px; border-top: 1px solid #3d8a6855; padding-top: 14px; }
.lobby-head { display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px; }
.lobby-head span { font-size: 13px; color: #9fd4bb; font-weight: bold; letter-spacing: 1px; }
#refreshLobbyBtn { background: transparent; border: 1px solid #3d8a68; color: #9fd4bb;
  padding: 3px 10px; border-radius: 6px; font-size: 14px; transition: all .15s; }
#refreshLobbyBtn:hover { background: #3d8a6833; transform: rotate(90deg); }
.room-list { max-height: 180px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.room-empty { text-align: center; color: #7fb59c; font-size: 12px; padding: 16px; }
.room-item { display: flex; justify-content: space-between; align-items: center;
  background: #10352a; border: 1px solid #3d8a68; border-radius: 8px;
  padding: 8px 12px; cursor: pointer; transition: all .15s; }
.room-item:hover { background: #1a4a3a; border-color: #ffd76e; transform: translateX(2px); }
.room-item .rname { font-weight: bold; color: #ffd76e; font-size: 14px; }
.room-item .rinfo { font-size: 12px; color: #9fd4bb; text-align: right; }
.room-item .rinfo strong { color: #fff; font-weight: bold; }
.room-item .phase-tag { display: inline-block; margin-left: 4px; font-size: 10px;
  padding: 1px 6px; border-radius: 4px; background: #3d8a6855; color: #9fd4bb; }
.room-item .phase-tag.ingame { background: #b57e1e55; color: #ffd76e; }

/* ---------- 布局 ---------- */
#game { display: flex; height: 100vh; }
#tableWrap { flex: 1; position: relative; display: flex; flex-direction: column; min-width: 0; }
#felt { flex: 1; position: relative; margin: 12px; border-radius: 50% / 46%;
  background: radial-gradient(ellipse at center, #3a8a63 0%, #25604599 55%, #16382b 100%),
  linear-gradient(#2a7a57, #1d5c41);
  border: 10px solid #5a3a20; box-shadow: inset 0 0 60px rgba(0,0,0,.45), 0 8px 30px rgba(0,0,0,.4); }

/* ---------- 中央区域 ---------- */
#center { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%);
  text-align: center; max-width: 90%; }
#phaseHint { font-size: 12px; color: #ffd76e99; letter-spacing: 2px; margin-bottom: 6px; text-transform: uppercase; }
#board { display: flex; gap: 8px; justify-content: center; min-height: 96px; flex-wrap: wrap; }
.cardimg { width: 66px; border-radius: 6px; box-shadow: 0 3px 8px rgba(0,0,0,.5);
  animation: deal .25s ease-out; }
@keyframes deal { from { transform: translateY(-30px) scale(.6); opacity: 0; } }
#pot { margin-top: 10px; font-size: 20px; font-weight: bold; color: #ffd76e;
  text-shadow: 0 2px 4px #000; }
#banner { margin-top: 8px; font-size: 17px; color: #ffe9a8; font-weight: bold;
  text-shadow: 0 1px 3px #000; min-height: 26px; }
#banner.alert { color: #9fd4ff; }

/* ---------- 座位 ---------- */
#seats { position: absolute; inset: 0; pointer-events: none; }
.seat { position: absolute; width: 170px; transform: translate(-50%, -50%);
  text-align: center; transition: filter .2s; pointer-events: auto; }
.seat .cards { display: flex; gap: 5px; justify-content: center; min-height: 70px; }
.seat .cards .cardimg { width: 50px; }
.seat .info { margin-top: 4px; display: inline-block; background: rgba(0,0,0,.55);
  border-radius: 14px; padding: 4px 12px; font-size: 13px; line-height: 1.5; position: relative; }
.seat .nm { font-weight: bold; color: #fff; }
.seat .ch { color: #ffd76e; }
.seat .act { color: #8fd0ff; min-height: 1.4em; display: block; font-size: 12px; }
.seat.me .info { border: 2px solid #ffd76e; }
.seat.turn .info { border: 2px solid #39d353; box-shadow: 0 0 16px #39d353aa; animation: pulse 1.2s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 8px #39d35366; } 50% { box-shadow: 0 0 20px #39d353cc; } }
.seat.turn.me .info { border-color: #ffb5ff; box-shadow: 0 0 20px #ffb5ffcc; }
.seat.folded { filter: grayscale(1) opacity(.5); }
.seat.folded .cards { filter: blur(1px); }
.seat.offline .info { filter: grayscale(1) opacity(.6); }
.seat .bet { position: absolute; left: 50%; transform: translateX(-50%); top: -30px;
  background: linear-gradient(180deg, #e0a93e, #b57e1e); color: #fff; font-weight: bold;
  font-size: 13px; padding: 2px 12px; border-radius: 12px; white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,.5); }
.dealer { position: absolute; width: 24px; height: 24px; line-height: 24px; border-radius: 50%;
  background: #fff; color: #222; font-weight: bold; font-size: 14px; right: -14px; top: -10px;
  box-shadow: 0 2px 5px rgba(0,0,0,.5); z-index: 2; }
.wintag { color: #7CFC90; font-weight: bold; display: block; font-size: 12px; }

/* ---------- 操作栏 ---------- */
#actionBar { display: flex; gap: 10px; align-items: center; justify-content: center;
  padding: 12px; background: rgba(0,0,0,.4); flex-wrap: wrap; }
.btn { padding: 12px 26px; font-size: 16px; font-weight: bold; border: none; border-radius: 8px;
  transition: filter .15s, transform .1s; }
.btn:hover:not(:disabled) { filter: brightness(1.15); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn.fold { background: #b03340; color: #fff; }
.btn.call { background: #2e7d54; color: #fff; }
.btn.raise { background: #2f6fb0; color: #fff; }
.btn.allin { background: #c07a1e; color: #fff; }
#raiseBox { display: flex; align-items: center; gap: 6px; background: rgba(255,255,255,.08);
  border-radius: 8px; padding: 6px 10px; flex-wrap: wrap; justify-content: center; }
.chipbtn { background: rgba(255,255,255,.12); color: #eee; border: 1px solid #3d8a68;
  border-radius: 6px; padding: 6px 10px; font-size: 12px; transition: background .15s; }
.chipbtn:hover { background: rgba(255,255,255,.2); }
#raiseRange { width: 140px; }
#raiseInput { width: 72px; padding: 8px; border-radius: 6px; border: 1px solid #3d8a68;
  background: #10352a; color: #fff; font-size: 14px; text-align: center; }

/* ---------- 侧栏 ---------- */
#sidebar { width: 300px; background: #0f211a; border-left: 1px solid #2c5a45;
  display: flex; flex-direction: column; }
#sideHead { padding: 10px 12px; border-bottom: 1px solid #2c5a45; display: flex;
  align-items: center; gap: 8px; flex-wrap: wrap; position: relative; }
#roomName { font-weight: bold; color: #ffd76e; font-size: 14px; flex: 1; }
#meta { font-size: 11px; color: #7fb59c; width: 100%; }
#leaveBtn { background: transparent; border: 1px solid #b03340; color: #ff9c9c;
  padding: 4px 10px; border-radius: 6px; font-size: 12px; }
#leaveBtn:hover { background: #b0334022; }
#log { flex: 1; overflow-y: auto; padding: 8px 12px; font-size: 13px; line-height: 1.8; color: #b9d9c8; }
#log .sys { color: #8fd0ff; }
#log .chat { color: #ffe9a8; }
#log .win { color: #7CFC90; }
#log .teamchat { color: #ffb5ff; font-style: italic; }
#chatBox { padding: 8px; border-top: 1px solid #2c5a45; }
#chatInput { width: 100%; padding: 10px; border-radius: 6px; border: 1px solid #3d8a68;
  background: #10352a; color: #fff; outline: none; }
#chatInput:focus { border-color: #ffd76e; }

/* ---------- 模式提示 & 规则卡 ---------- */
.variant-hint { font-size: 12px; color: #9fd4bb; background: #0d2a2088;
  padding: 8px 10px; border-radius: 8px; border-left: 3px solid #3d8a68;
  text-align: left; line-height: 1.6; min-height: 2.4em; transition: all .2s; }
.variant-hint:empty { display: none; }
.variant-hint strong { color: #ffd76e; }

#rulesBtn { background: transparent; border: 1px solid #3d8a68; color: #9fd4bb;
  padding: 4px 10px; border-radius: 6px; font-size: 13px; cursor: pointer;
  transition: all .15s; }
#rulesBtn:hover { border-color: #ffd76e; color: #ffd76e; background: #3d8a6822; }
#ledgerBtn { background: transparent; border: 1px solid #3d8a68; color: #9fd4bb;
  padding: 4px 10px; border-radius: 6px; font-size: 13px; cursor: pointer; transition: all .15s; }
#ledgerBtn:hover { border-color: #ffd76e; color: #ffd76e; background: #3d8a6822; }
#botBtn { background: transparent; border: 1px solid #3d8a68; color: #9fd4bb;
  padding: 4px 8px; border-radius: 6px; font-size: 13px; cursor: pointer; transition: all .15s; }
#botBtn:hover { border-color: #ffd76e; color: #ffd76e; background: #3d8a6822; }
#botMenu { position: absolute; top: 100%; right: 12px; z-index: 30; margin-top: 4px;
  background: #10352a; border: 1px solid #3d8a68; border-radius: 8px; padding: 6px;
  display: flex; flex-direction: column; gap: 4px; min-width: 170px; box-shadow: 0 6px 18px rgba(0,0,0,.45); }
#botMenu .bot-menu-title { font-size: 11px; color: #7fb59c; padding: 2px 6px; }
#botMenu button { background: transparent; border: none; color: #d8efe3; text-align: left;
  padding: 6px 8px; border-radius: 5px; font-size: 13px; cursor: pointer; }
#botMenu button:hover { background: #3d8a6833; color: #ffd76e; }
.bot-tag { display: inline-block; font-size: 10px; padding: 0 5px; margin-left: 4px;
  border-radius: 4px; background: #5b4a8f; color: #fff; font-weight: normal; vertical-align: 1px; }
.seat .info { position: relative; }
.bot-kick { position: absolute; top: -8px; right: -8px; width: 18px; height: 18px; padding: 0;
  border-radius: 50%; border: 1px solid #b03340; background: #2a1216; color: #ff9c9c;
  font-size: 12px; line-height: 16px; cursor: pointer; opacity: .7; }
.bot-kick:hover { opacity: 1; background: #b03340; color: #fff; }
#ledgerBtn .live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 5px; background: #39d353; animation: pulse-dot 1.5s infinite; vertical-align: 1px; }

/* ledger 条目 */
.ledger-row { display: grid; grid-template-columns: 30px 1fr 70px 60px 70px; gap: 8px;
  padding: 8px 6px; font-size: 13px; align-items: center;
  border-bottom: 1px dashed #3d8a6833; }
.ledger-row.head { color: #9fd4bb; font-size: 11px; border-bottom: 1px solid #3d8a68; }
.ledger-row .rk { color: #ffd76e; font-weight: bold; text-align: center; }
.ledger-row .nm { color: #fff; font-weight: bold; overflow: hidden; text-overflow: ellipsis; }
.ledger-row .pf { text-align: right; font-weight: bold; }
.ledger-row .pf.pos { color: #7CFC90; }
.ledger-row .pf.neg { color: #ff9c9c; }
.ledger-row .ws, .ledger-row .ko { text-align: center; color: #b9d9c8; font-size: 12px; }
.ledger-row.mvp .nm::before { content: '👑 '; }
.ledger-empty { padding: 20px; color: #7fb59c; text-align: center; font-size: 13px; }

/* 首富角标(大厅房间条目) */
.room-item .top-winner { display: block; font-size: 11px; color: #7CFC90; margin-top: 2px; }

/* 组队标签 */
.team-tag { display: inline-block; font-size: 10px; padding: 0 5px; margin-left: 4px;
  border-radius: 3px; font-weight: bold; vertical-align: 1px; }
.team-tag.A { background: #2f6fb0; color: #fff; }
.team-tag.B { background: #b03340; color: #fff; }
.seat.teammate .info { border: 2px dashed #39d353; }

/* 明牌模式下自己的卡背特殊提示 */
.seat.indian-me .cards .cardimg { filter: grayscale(0.5) brightness(0.7); transform: rotate(180deg); }
.seat.indian-me .info::after { content: '你看不到自己的牌 😈'; display: block;
  font-size: 10px; color: #ff9c9c; margin-top: 2px; }

#rulesModal { position: fixed; inset: 0; background: rgba(0, 0, 0, .65);
  display: flex; align-items: center; justify-content: center; z-index: 200;
  backdrop-filter: blur(4px); padding: 16px; }
.rules-card { position: relative; background: linear-gradient(160deg, #14352a, #0d231c);
  border: 1px solid #3d8a68; border-radius: 14px; padding: 24px 28px;
  max-width: min(560px, 92vw); max-height: 85vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .7); }
.rules-card h2 { color: #ffd76e; margin-bottom: 14px; font-size: 22px; letter-spacing: 2px; }
#rulesClose { position: absolute; top: 10px; right: 12px; background: transparent;
  border: none; color: #9fd4bb; font-size: 28px; cursor: pointer; line-height: 1;
  padding: 4px 8px; border-radius: 6px; transition: all .15s; }
#rulesClose:hover { color: #ff9c9c; background: #b0334033; }

#rulesBody { color: #d6e8dd; font-size: 14px; line-height: 1.8; }
#rulesBody h3 { color: #ffd76e; font-size: 16px; margin: 18px 0 8px; letter-spacing: 1px; }
#rulesBody h3:first-child { margin-top: 0; }
#rulesBody p { margin: 6px 0; }
#rulesBody ul { margin: 6px 0 6px 20px; }
#rulesBody li { margin: 4px 0; }
#rulesBody .row { display: flex; justify-content: space-between; padding: 4px 0;
  border-bottom: 1px dashed #3d8a6833; font-size: 13px; }
#rulesBody .row:last-child { border-bottom: none; }
#rulesBody .row .k { color: #9fd4bb; }
#rulesBody .row .v { color: #ffd76e; font-weight: bold; }
#rulesBody .diff { background: #b0334018; border-left: 3px solid #b03340;
  padding: 8px 12px; margin: 8px 0; border-radius: 4px; font-size: 13px; }
#rulesBody .diff strong { color: #ff9c9c; }
#rulesBody .ok { background: #39d35318; border-left: 3px solid #39d353;
  padding: 8px 12px; margin: 8px 0; border-radius: 4px; font-size: 13px; }
#rulesBody .ok strong { color: #7CFC90; }

/* ---------- 旁观条 ---------- */
#spectatorBar { display: flex; gap: 10px; align-items: center; justify-content: center;
  padding: 12px; background: rgba(30, 50, 70, .6); border-top: 1px dashed #3d8a68; }
.spec-tag { color: #9fd4ff; font-size: 13px; letter-spacing: 1px; }
.spec-tag::before { content: ''; display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; background: #39d353; margin-right: 6px; animation: pulse-dot 1.5s infinite; }
@keyframes pulse-dot { 0%,100% { opacity: .5; } 50% { opacity: 1; } }
#sitNameInput { padding: 10px; border-radius: 6px; border: 1px solid #3d8a68;
  background: #10352a; color: #fff; font-size: 14px; width: 140px; }
#sitNameInput:focus { border-color: #ffd76e; outline: none; }
.btn.sit { background: #2f6fb0; color: #fff; }
.btn.peek { background: #6b1eb0; color: #fff; }

/* 铭牌 */
.seat-tags { display: flex; gap: 3px; justify-content: center; margin-top: 2px;
  flex-wrap: wrap; min-height: 16px; }
.seat-tag { font-size: 11px; padding: 1px 5px; border-radius: 4px;
  background: rgba(255, 215, 110, 0.15); color: #ffd76e; border: 1px solid #ffd76e44;
  white-space: nowrap; }

/* 小丑 perk 面板 */
.perk-panel { position: absolute; bottom: -40px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 6px; background: rgba(107, 30, 176, 0.8); padding: 3px 8px;
  border-radius: 6px; font-size: 11px; white-space: nowrap; }
.perk-item { color: #ffb5ff; }
.spec-btn { background: transparent; border: 1px solid #3d8a68; color: #9fd4bb;
  padding: 2px 8px; border-radius: 6px; font-size: 12px; margin-left: 6px; cursor: pointer;
  transition: all .15s; }
.spec-btn:hover { background: #3d8a6844; border-color: #ffd76e; color: #ffd76e; }

/* 模式标签 */
.variant-tag { display: inline-block; font-size: 10px; padding: 1px 6px; border-radius: 4px;
  margin-right: 4px; font-weight: bold; letter-spacing: 0.5px; vertical-align: 1px; }
.variant-tag.short { background: #b03340; color: #fff; }
.variant-tag.allin { background: #c07a1e; color: #fff; }
.variant-tag.turbo { background: #2f6fb0; color: #fff; }
.variant-tag.bounty { background: #6b1eb0; color: #fff; }
.variant-tag.indian { background: #b03340; color: #ff9c9c; }
.variant-tag.loot { background: #b57e1e; color: #fff; }
.variant-tag.duo { background: #1e8a5a; color: #fff; }

/* ---------- Toast(顶部提示条,不遮挡牌桌) ---------- */
#toast { position: fixed; top: 0; left: 50%; transform: translate(-50%, -100%);
  background: rgba(20, 40, 60, .95); color: #9fd4ff; padding: 10px 22px;
  border-radius: 0 0 12px 12px; font-size: 14px; z-index: 100;
  transition: transform .3s; box-shadow: 0 4px 20px rgba(0,0,0,.5); pointer-events: none; }
#toast.show { transform: translate(-50%, 0); }

/* ---------- 手机 ---------- */
@media (max-width: 900px) {
  #game { flex-direction: column; }
  #sidebar { width: 100%; height: 32vh; border-left: none; border-top: 1px solid #2c5a45; }
  .cardimg { width: 46px; }
  .seat { width: 130px; }
  .seat .cards .cardimg { width: 34px; }
  .seat .info { font-size: 11px; padding: 2px 8px; }
  #actionBar { gap: 6px; padding: 8px; }
  .btn { padding: 10px 14px; font-size: 14px; }
  #raiseRange { width: 90px; }
}
