/* ============================================================
   我爱卡五星 52kwx — 横屏H5麻将
   米黄色主色调 · 墨绿桌布 · 横屏强制
   ============================================================ */

:root {
  --beige: #F5E9C8;
  --beige-light: #FAF3DE;
  --beige-dark: #E8D9A8;
  --brown: #5D4037;
  --brown-light: #8D6E63;
  --dark-red: #8B1A1A;
  --red: #C0392B;
  --green-table: #1B5E3F;
  --green-table-dark: #0F3D28;
  --green-felt: #2E7D4F;
  --gold: #C9A94E;
  --gold-light: #E8D48B;
  --white: #FFFDF5;
  --shadow: 0 2px 8px rgba(93, 64, 55, 0.25);
  --radius: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  width: 100%; height: 100%;
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  background: var(--beige);
  color: var(--brown);
  overflow: hidden;
  font-size: 14px;
  user-select: none;
}

/* 竖屏下非游戏界面允许滚动 */
body.portrait-mode {
  overflow: auto;
}
body.portrait-mode .screen.active {
  overflow-y: auto;
}
body.portrait-mode #screen-game {
  overflow: hidden;
}

/* ============ 横屏强制提示（仅游戏界面） ============ */
#rotate-mask {
  display: none;
  position: fixed; inset: 0;
  background: var(--beige);
  z-index: 9999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  text-align: center;
}
#rotate-mask.game-only {
  /* 仅在游戏界面显示 */
}
#rotate-mask .rotate-icon {
  font-size: 60px;
  animation: rotatePhone 2s ease-in-out infinite;
}
#rotate-mask .rotate-text {
  font-size: 20px;
  color: var(--dark-red);
  font-weight: bold;
}
#rotate-mask .rotate-sub {
  font-size: 14px;
  color: var(--brown-light);
}
#rotate-mask .rotate-dismiss {
  margin-top: 12px;
  padding: 10px 32px;
  background: var(--dark-red);
  color: var(--beige-light);
  border: none;
  border-radius: 20px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(139, 26, 26, 0.3);
}
#rotate-mask .rotate-dismiss:active { transform: scale(0.95); }
@keyframes rotatePhone {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(90deg); }
}
.rotate-icon::before {
  content: '';
  display: block;
  width: 50px;
  height: 30px;
  border: 3px solid var(--dark-red);
  border-radius: 6px;
  position: relative;
  animation: rotatePhone 2s ease-in-out infinite;
}
.rotate-icon::after {
  content: '';
  display: block;
  width: 14px;
  height: 14px;
  border: 3px solid var(--dark-red);
  border-left: none;
  border-top: none;
  transform: rotate(-45deg);
  margin: -22px auto 0;
  position: relative;
}

/* ============ 通话/视频浮窗提示 ============ */
#float-widget {
  position: fixed;
  top: 8px;
  left: 8px;
  background: rgba(30, 30, 30, 0.92);
  color: #fff;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  z-index: 8000;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  user-select: none;
  animation: floatSlideIn 0.3s ease;
}
#float-widget:active { opacity: 0.7; }
.float-icon { font-size: 16px; }
@keyframes floatSlideIn {
  from { transform: translateX(-100%); opacity: 0; }
  to   { transform: translateX(0);     opacity: 1; }
}

/* ============ 屏幕容器 ============ */
.screen {
  display: none;
  width: 100%; height: 100%;
  position: absolute; inset: 0;
  overflow: hidden;
}
.screen.active { display: flex; flex-direction: column; }

/* ============ 通用组件 ============ */
.btn-primary {
  background: linear-gradient(135deg, var(--dark-red), #A52A2A);
  color: var(--beige-light);
  border: none;
  padding: 10px 28px;
  border-radius: 24px;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(139, 26, 26, 0.3);
  transition: transform 0.1s;
}
.btn-primary:active { transform: scale(0.95); }

.btn-gold {
  background: linear-gradient(135deg, var(--gold), #B8942F);
  color: #3E2723;
  border: none;
  padding: 10px 28px;
  border-radius: 24px;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(201, 169, 78, 0.4);
}
.btn-gold:active { transform: scale(0.95); }

.toast {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  background: rgba(62, 39, 35, 0.92);
  color: var(--beige-light);
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 9000;
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
  max-width: 80vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* ============ 麻将牌 ============ */
.mj-tile {
  display: inline-block;
  vertical-align: bottom;
  position: relative;
  cursor: default;
  transition: transform 0.15s, margin 0.15s;
  flex-shrink: 0;
}
.mj-tile.clickable { cursor: pointer; }
.mj-tile.clickable:hover { transform: translateY(-4px); }
.mj-tile.selected { transform: translateY(-12px); }
.mj-tile.just-discarded {
  box-shadow: 0 0 8px 3px var(--gold);
  border-radius: 4px;
}
.mj-tile-svg { display: block; }

/* 牌尺寸 */
.tile-hand .mj-tile-svg { width: 57px; height: 84px; }
.tile-hand { margin: 0 -2px; }
.tile-hand.drawn-tile { margin-left: 6px; }

.tile-discard .mj-tile-svg { width: 13px; height: 19px; }
.tile-meld .mj-tile-svg { width: 34px !important; height: 50px !important; }
.tile-meld-sm .mj-tile-svg { width: 11px !important; height: 17px !important; }
.tile-meld-top .mj-tile-svg { width: 10px !important; height: 15px !important; }
.tile-side .mj-tile-svg { width: 18px; height: 28px; }
.tile-top .mj-tile-svg { width: 16px; height: 26px; }
.tile-settle .mj-tile-svg { width: 34px; height: 51px; }
.tile-ma .mj-tile-svg { width: 44px; height: 65px; }

/* ============ 首页 ============ */
#screen-home {
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255, 240, 200, 0.6), transparent 60%),
    linear-gradient(160deg, var(--beige-light) 0%, var(--beige) 40%, var(--beige-dark) 100%);
  align-items: center;
  justify-content: center;
  position: relative;
}

.home-decor {
  position: absolute;
  font-size: 80px;
  opacity: 0.08;
  pointer-events: none;
}
.home-decor.d1 { top: 8%; left: 5%; transform: rotate(-15deg); }
.home-decor.d2 { bottom: 10%; right: 8%; transform: rotate(20deg); }
.home-decor.d3 { top: 15%; right: 12%; font-size: 50px; transform: rotate(10deg); }

.home-title {
  font-size: 52px;
  font-weight: 900;
  color: var(--dark-red);
  text-shadow: 2px 2px 0 var(--gold-light), 4px 4px 8px rgba(139, 26, 26, 0.2);
  letter-spacing: 6px;
  margin-bottom: 8px;
}
.home-subtitle {
  font-size: 18px;
  color: var(--brown);
  font-weight: bold;
  margin-bottom: 6px;
  letter-spacing: 2px;
}

.home-btn {
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  border: 2px solid var(--beige-dark);
  background: var(--white);
  color: var(--brown);
  box-shadow: var(--shadow);
  transition: transform 0.1s, box-shadow 0.1s;
}
.home-btn:active { transform: scale(0.96); }
.home-btn.primary {
  background: linear-gradient(135deg, var(--dark-red), #A52A2A);
  color: var(--beige-light);
  border-color: var(--dark-red);
  font-size: 18px;
  padding: 16px;
}
.home-btn .btn-icon { margin-right: 6px; }

/* ============ 登录页 - 两列布局 ============ */
.login-two-col {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 20px;
  z-index: 2;
  width: 100%;
  max-width: 960px;
  padding: 10px 20px;
}

/* 左列：声明方框 60% */
.login-left {
  flex: 0 0 60%;
  max-width: 60%;
  text-align: left;
  background: rgba(255,253,245,0.85);
  border: 2px solid var(--gold);
  border-radius: 16px;
  padding: 20px 22px 16px;
  box-shadow: 0 4px 20px rgba(93,64,55,0.15);
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-sizing: border-box;
}
.login-left .home-title {
  font-size: 32px;
  letter-spacing: 4px;
  margin-bottom: 4px;
}
.login-left .home-subtitle {
  font-size: 14px;
  margin-bottom: 14px;
  color: var(--brown);
}
.login-declare {
  font-size: 13px;
  color: var(--brown-light);
  line-height: 2;
}
.login-declare p { margin-bottom: 8px; }
.login-declare p:last-child { margin-bottom: 0; }
.login-declare strong { color: var(--dark-red); }

/* 右列：登录方框 40% */
.login-right {
  flex: 0 0 40%;
  max-width: 40%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-box {
  background: rgba(255,253,245,0.85);
  border: 2px solid var(--gold);
  border-radius: 16px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  box-shadow: 0 4px 20px rgba(93,64,55,0.15);
}

/* 登录按钮缩小 */
.login-box .home-btn {
  padding: 10px 16px;
  font-size: 14px;
  width: 100%;
  text-align: center;
}
.login-box .home-btn.primary {
  font-size: 15px;
  padding: 11px 16px;
}
.login-box .login-tip {
  font-size: 11px;
  text-align: center;
  margin-top: 2px;
  color: var(--brown-light);
}

.login-divider {
  text-align: center;
  color: var(--brown-light);
  font-size: 12px;
  position: relative;
  margin: 2px 0;
  width: 100%;
}
.login-divider::before,
.login-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 28%;
  height: 1px;
  background: var(--beige-dark);
}
.login-divider::before { left: 5%; }
.login-divider::after { right: 5%; }
.login-tip {
  font-size: 11px;
  color: var(--brown-light);
  margin-top: 20px;
}

/* 手动登录弹窗输入框 */
#modal-manual-login .form-group {
  margin: 20px 0;
}
#modal-manual-login input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--beige-dark);
  border-radius: var(--radius);
  font-size: 16px;
  text-align: center;
  letter-spacing: 2px;
  outline: none;
  background: var(--white);
}
#modal-manual-login input:focus {
  border-color: var(--gold);
}

/* ============ 大厅 ============ */
#screen-lobby {
  background: linear-gradient(160deg, var(--beige-light), var(--beige));
}

.lobby-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: linear-gradient(135deg, var(--brown), #795548);
  color: var(--beige-light);
}
.lobby-title {
  font-size: 20px;
  font-weight: bold;
  letter-spacing: 2px;
}
.lobby-balance {
  background: rgba(255, 253, 245, 0.15);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 14px;
}
.lobby-balance .coin { color: var(--gold-light); font-weight: bold; }

.lobby-user {
  display: flex;
  align-items: center;
  background: rgba(255, 253, 245, 0.15);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 14px;
}
.lobby-user .coin { color: var(--gold-light); font-weight: bold; }

.lobby-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 16px 20px 0;
  overflow: hidden;
  min-height: 0;
}

.lobby-main {
  flex: 1;
  min-height: 0;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  overflow-y: auto;
}
.lobby-main h3 {
  color: var(--dark-red);
  margin-bottom: 12px;
  font-size: 16px;
}

.lobby-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.lobby-link {
  flex: 1;
  min-width: 100px;
  background: var(--beige-light);
  border: 1px solid var(--beige-dark);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.1s;
}
.lobby-link:active { transform: scale(0.96); }
.lobby-link .ll-icon { font-size: 28px; display: block; margin-bottom: 4px; }
.lobby-link .ll-text { font-size: 13px; color: var(--brown); font-weight: bold; }

.lobby-side {
  display: none; /* 隐藏，按钮已移到底部导航 */
}

/* ============ 底部导航栏 ============ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--white);
  border-top: 2px solid var(--beige-dark);
  display: flex;
  align-items: center;
  justify-content: space-around;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  z-index: 10000;
}
.nav-btn {
  flex: 1;
  height: 100%;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: bold;
  color: var(--brown);
  cursor: pointer;
  transition: all 0.2s;
}
.nav-btn:active {
  transform: scale(0.95);
  background: var(--beige-light);
}
.nav-btn.nav-primary {
  background: linear-gradient(135deg, var(--dark-red), #A52A2A);
  color: var(--beige-light);
  font-size: 16px;
}
.nav-btn.nav-primary:active {
  background: linear-gradient(135deg, #A52A2A, var(--dark-red));
}

/* ============ 开局设置弹窗 ============ */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.modal-overlay.show { display: flex; }

.modal {
  background: var(--beige-light);
  border-radius: 14px;
  padding: 20px 24px;
  width: 88%;
  max-width: 420px;
  max-height: 92vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}
.modal-title {
  font-size: 20px;
  font-weight: bold;
  color: var(--dark-red);
  text-align: center;
  margin-bottom: 14px;
  flex-shrink: 0;
}

.settings-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  flex: 1;
  padding-right: 4px;
}
.setting-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.setting-row label {
  font-size: 14px;
  color: var(--brown);
  min-width: 72px;
  font-weight: bold;
}
.setting-row select, .setting-row input[type="number"] {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--beige-dark);
  border-radius: 6px;
  background: var(--white);
  font-size: 14px;
  color: var(--brown);
  min-height: 40px;
}
.setting-row.checkbox {
  /* single column, no span needed */
}
.setting-row.checkbox label {
  min-width: auto;
  font-size: 14px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 20px;
}
.modal-actions button {
  padding: 10px 32px;
  border-radius: 24px;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  border: none;
}
.modal-actions .btn-cancel { background: var(--beige-dark); color: var(--brown); }
.modal-actions .btn-confirm { background: linear-gradient(135deg, var(--dark-red), #A52A2A); color: var(--beige-light); }

/* ============ 牌桌界面 ============ */
#screen-game {
  background: var(--green-table-dark);
  flex-direction: column;
}

.game-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  background: rgba(0, 0, 0, 0.3);
  color: var(--beige-light);
  font-size: 13px;
  z-index: 5;
}
.game-topbar .back-btn {
  background: rgba(255, 253, 245, 0.15);
  border: none;
  color: var(--beige-light);
  padding: 4px 12px;
  border-radius: 14px;
  font-size: 12px;
  cursor: pointer;
}

#game-table {
  flex: 1;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse at center, var(--green-felt) 0%, var(--green-table) 50%, var(--green-table-dark) 100%);
}

.table-inner {
  position: absolute; inset: 0;
  display: flex;
  flex-direction: column;
}

/* 对手区域（覆盖整个牌桌） */
.opponents-area {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}
.opponents-area .opponent {
  pointer-events: auto;
}

.opponent {
  position: absolute;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 6px 8px;
}
.opp-top {
  top: 6px; left: 50%;
  transform: translateX(-50%);
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.opp-top .opp-hand {
  display: flex;
  gap: 1px;
  justify-content: center;
  flex-wrap: nowrap;
}
.opp-left {
  left: 6px; top: 38%;
  transform: translateY(-50%);
  flex-direction: column;
  align-items: flex-start;
  max-width: 110px;
}
.opp-left .opp-hand {
  display: flex;
  flex-direction: column;
  gap: 1px;
  align-items: flex-start;
}
.opp-right {
  right: 6px; top: 38%;
  transform: translateY(-50%);
  flex-direction: column;
  align-items: flex-end;
  max-width: 110px;
}
.opp-right .opp-hand {
  display: flex;
  flex-direction: column;
  gap: 1px;
  align-items: flex-end;
}

/* 3人模式空位 */
.empty-seat {
  position: absolute;
  top: 6px; left: 50%;
  transform: translateX(-50%);
  text-align: center;
  color: rgba(255,255,255,0.35);
  font-size: 11px;
  pointer-events: none;
}
.empty-chair {
  font-size: 28px;
  opacity: 0.4;
  margin-bottom: 2px;
}

.opp-avatar {
  width: 36px; height: 36px;
  background: var(--beige);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border: 2px solid var(--gold);
}
.opp-info { color: var(--beige-light); font-size: 11px; }
.opp-name { font-weight: bold; font-size: 12px; }
.opp-tiles-count { opacity: 0.8; }
.opp-score { font-weight: bold; color: var(--gold-light); font-size: 13px; }
.opp-melds {
  display: flex;
  gap: 2px;
  margin: 3px 0;
  flex-wrap: nowrap;
  justify-content: center;
  overflow: hidden;
}
.opp-hand .mj-tile { margin: 0 -2px; }
.opp-discards { display: none; }

.zhuang-badge {
  display: inline-block;
  background: var(--dark-red);
  color: var(--beige-light);
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 2px;
}

/* 中央区域 */
.center-area {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.deck-info {
  position: absolute;
  top: 10%; left: 50%;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.35) 100%);
  color: var(--gold-light);
  width: 60px; height: 60px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: bold;
  border: 2px solid rgba(201,169,78,0.5);
  box-shadow: 0 0 12px rgba(0,0,0,0.4);
  line-height: 1;
  z-index: 4;
}
.deck-info small {
  font-size: 10px;
  font-weight: normal;
  color: var(--beige-light);
  opacity: 0.7;
  margin-top: 2px;
}
.round-info {
  position: absolute;
  top: 8px; left: 16px;
  background: rgba(0, 0, 0, 0.3);
  color: var(--gold-light);
  padding: 4px 12px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: bold;
}

.discard-pile {
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  padding: 3px 4px;
  justify-content: flex-start;
  align-content: flex-start;
  background: rgba(0,0,0,0.12);
  border-radius: 4px;
  border-left: 3px solid transparent;
  margin-bottom: 2px;
}
.discard-pile-0 { border-left-color: rgba(52,152,219,0.7); }
.discard-pile-1 { border-left-color: rgba(231,76,60,0.7); }
.discard-pile-2 { border-left-color: rgba(46,204,113,0.7); }
.discard-pile-label {
  font-size: 10px;
  color: var(--gold-light);
  opacity: 0.7;
  margin-bottom: 1px;
  padding-left: 4px;
}
/* 统一牌河容器 */
.discard-river {
  position: absolute;
  top: 48%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 150px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(201,169,78,0.3) transparent;
}
.discard-river::-webkit-scrollbar { width: 3px; }
.discard-river::-webkit-scrollbar-thumb { background: rgba(201,169,78,0.3); border-radius: 2px; }
/* 隐藏旧的单独牌河定位 */
.discard-pile-0, .discard-pile-1, .discard-pile-2 {
  position: static;
  transform: none;
  max-height: none;
  overflow: visible;
  max-width: none;
}

/* 自己区域 */
.my-area {
  flex: 0 0 auto;
  padding: 6px 12px 8px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.2));
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}
.my-info-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
  color: var(--beige-light);
  font-size: 12px;
  width: 100%;
}
.my-name { font-weight: bold; }
.my-score {
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 10px;
  border-radius: 10px;
  color: var(--gold-light);
  font-weight: bold;
}
.my-melds {
  display: flex;
  gap: 6px;
  flex: 1;
}
.my-melds .meld {
  display: flex;
  gap: 0;
}
.my-melds .meld .mj-tile { margin: 0 -2px; }

.my-hand-area {
  flex: 1;
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 4px 0;
  min-width: 0;
}
/* 操作按钮浮动在右上角 */
.action-float {
  position: absolute;
  top: 2px;
  right: 6px;
  z-index: 10;
  display: flex;
  flex-direction: row;
  gap: 8px;
  pointer-events: none;
}
.action-float .btn-action {
  pointer-events: auto;
  background: rgba(0,0,0,0.55);
  border-radius: 16px;
  padding: 6px 14px;
  font-size: 16px;
  min-width: auto;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.my-hand {
  display: flex;
  align-items: flex-end;
  gap: 0;
  padding: 8px 4px 4px;
  min-width: min-content;
  justify-content: center;
}

/* 操作按钮栏 — 移到右侧，纵向排列 */
.action-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 0;
  flex-shrink: 0;
  align-items: center;
  min-width: 52px;
}
.btn-action {
  padding: 5px 0;
  border-radius: 6px;
  border: none;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.1s;
  background: transparent;
  color: #ff4444;
  min-width: 52px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.btn-action:active { transform: scale(0.92); }
.btn-discard { background: var(--dark-red); color: var(--beige-light); border-radius: 20px; padding: 6px 22px; text-shadow: none; }
.btn-hu { color: #FFD700; font-size: 18px; }
.btn-gang { color: #64B5F6; }
.btn-peng { color: #81C784; }
.btn-pass { color: rgba(255,255,255,0.5); font-size: 14px; }
.btn-liang { color: #FF9800; }
.btn-ting { color: #CE93D8; font-size: 14px; }

/* 操作按钮出现时的动画 */
.btn-action:not([style*="display: none"]) {
  animation: claimPulse 0.6s ease-out;
}
@keyframes claimPulse {
  0% { transform: scale(0.5); opacity: 0; }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

/* 操作提示横幅 */
.claim-prompt {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 12px 28px;
  border-radius: 12px;
  font-size: 18px;
  font-weight: bold;
  z-index: 100;
  pointer-events: none;
  animation: claimFadeIn 0.3s ease-out;
  text-align: center;
  white-space: nowrap;
}
@keyframes claimFadeIn {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* 声音开关按钮 */
.sound-toggle {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  opacity: 0.8;
  transition: opacity 0.2s;
}
.sound-toggle:active { opacity: 1; transform: scale(0.9); }

/* ============ 买马动画 ============ */
.ma-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s;
}
.ma-overlay.fade-out { opacity: 0; }
.ma-panel {
  text-align: center;
  color: var(--beige-light);
}
.ma-title {
  font-size: 28px;
  font-weight: bold;
  color: var(--gold-light);
  margin-bottom: 20px;
}
.ma-tiles {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 20px;
}
.ma-tile-animate {
  animation: maFlip 0.6s ease-out;
}
@keyframes maFlip {
  0% { transform: rotateY(180deg) scale(0.5); opacity: 0; }
  100% { transform: rotateY(0deg) scale(1); opacity: 1; }
}
.ma-score {
  font-size: 22px;
  font-weight: bold;
  color: #FFD54F;
}

/* ============ 结算面板 ============ */
.settle-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.settle-panel {
  background: var(--beige-light);
  border-radius: 14px;
  padding: 24px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  text-align: center;
}
.settle-title {
  font-size: 22px;
  font-weight: bold;
  color: var(--dark-red);
  margin-bottom: 14px;
}
.settle-tiles {
  display: flex;
  gap: 2px;
  justify-content: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.settle-types {
  font-size: 13px;
  color: var(--brown);
  margin-bottom: 14px;
  line-height: 1.6;
}
.settle-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 16px;
}
.settle-table th {
  background: var(--brown);
  color: var(--beige-light);
  padding: 8px 6px;
  font-weight: normal;
}
.settle-table td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--beige-dark);
}
.settle-table .winner-row { background: rgba(201, 169, 78, 0.15); }
.settle-table .ting-row { background: rgba(46, 125, 79, 0.1); }
.pos { color: var(--dark-red); font-weight: bold; }
.neg { color: #1565C0; font-weight: bold; }

.room-end-table { max-width: 420px; margin: 0 auto 16px; }

/* ============ 群聊界面 ============ */
#screen-group {
  background: var(--beige);
}
.group-header {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  background: var(--brown);
  color: var(--beige-light);
  gap: 10px;
}
.group-header .back-btn {
  background: rgba(255, 253, 245, 0.15);
  border: none;
  color: var(--beige-light);
  padding: 4px 12px;
  border-radius: 14px;
  font-size: 12px;
  cursor: pointer;
}
.group-header-title { flex: 1; text-align: center; font-weight: bold; font-size: 16px; }

.group-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.msg {
  display: flex;
  gap: 8px;
  max-width: 75%;
}
.msg-self { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar {
  width: 34px; height: 34px;
  background: var(--beige-dark);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.msg-bubble {
  background: var(--white);
  padding: 8px 12px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  position: relative;
}
.msg-self .msg-bubble { background: #D4EDDA; }
.msg-name { font-size: 11px; color: var(--brown-light); margin-bottom: 2px; }
.msg-text { font-size: 14px; color: var(--brown); line-height: 1.5; }
.msg-time { font-size: 10px; color: #aaa; margin-top: 4px; text-align: right; }
.msg-img {
  font-size: 60px;
  text-align: center;
  padding: 10px;
}

/* 房间卡片消息 */
.msg-room-card { max-width: 320px; }
.room-card {
  background: var(--white);
  border-radius: 10px;
  padding: 12px;
  box-shadow: var(--shadow);
  width: 260px;
}
.room-card-title {
  font-weight: bold;
  color: var(--dark-red);
  font-size: 14px;
  margin-bottom: 8px;
  text-align: center;
}
.room-card-table {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
}
.room-card-table td {
  padding: 4px 6px;
  border-bottom: 1px solid #f0e4c8;
}
.room-card-table td:first-child {
  color: var(--brown-light);
  white-space: nowrap;
}
.room-card-table select {
  border: 1px solid var(--beige-dark);
  border-radius: 4px;
  padding: 2px;
  font-size: 11px;
  background: var(--beige-light);
}
.join-link { color: var(--dark-red); font-weight: bold; cursor: pointer; }
.btn-room-start {
  width: 100%;
  margin-top: 8px;
  padding: 8px;
  background: linear-gradient(135deg, var(--dark-red), #A52A2A);
  color: var(--beige-light);
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
}

.group-input-bar {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: var(--beige-light);
  border-top: 1px solid var(--beige-dark);
}
.group-input-bar input {
  flex: 1;
  padding: 8px 14px;
  border: 1px solid var(--beige-dark);
  border-radius: 20px;
  font-size: 14px;
  background: var(--white);
}
.group-input-bar button {
  padding: 8px 20px;
  background: var(--dark-red);
  color: var(--beige-light);
  border: none;
  border-radius: 20px;
  font-weight: bold;
  cursor: pointer;
}

/* ============ 用户中心 ============ */
#screen-user { background: var(--beige); }
.uc-header {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  background: var(--brown);
  color: var(--beige-light);
  gap: 10px;
}
.uc-header .back-btn {
  background: rgba(255, 253, 245, 0.15);
  border: none;
  color: var(--beige-light);
  padding: 4px 12px;
  border-radius: 14px;
  font-size: 12px;
  cursor: pointer;
}
.uc-header-title { flex: 1; font-weight: bold; font-size: 16px; }
.uc-balance { color: var(--gold-light); font-weight: bold; }

.uc-tabs {
  display: flex;
  background: var(--beige-light);
  border-bottom: 1px solid var(--beige-dark);
}
.uc-tab {
  flex: 1;
  padding: 12px;
  text-align: center;
  font-size: 14px;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--brown-light);
  font-weight: bold;
  border-bottom: 3px solid transparent;
}
.uc-tab.active {
  color: var(--dark-red);
  border-bottom-color: var(--dark-red);
}

.uc-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}
.uc-subtabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.uc-subtab {
  padding: 6px 16px;
  border: 1px solid var(--beige-dark);
  background: var(--white);
  border-radius: 16px;
  font-size: 13px;
  cursor: pointer;
  color: var(--brown);
}
.uc-subtab.active {
  background: var(--dark-red);
  color: var(--beige-light);
  border-color: var(--dark-red);
}
.uc-summary {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 12px;
  text-align: center;
}
.uc-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.uc-table th {
  background: var(--brown);
  color: var(--beige-light);
  padding: 10px 8px;
  font-size: 13px;
  font-weight: normal;
}
.uc-table td {
  padding: 10px 8px;
  border-bottom: 1px solid #f0e4c8;
  font-size: 13px;
  text-align: center;
}

/* ============ 充值/提现页 ============ */
.pay-page {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  gap: 24px;
  align-items: flex-start;
  justify-content: center;
}
.pay-qr {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
  min-width: 180px;
}
.pay-qr .qr-placeholder {
  width: 140px; height: 140px;
  background:
    repeating-linear-gradient(45deg, var(--beige-dark) 0 4px, var(--white) 4px 8px),
    var(--beige);
  border: 2px solid var(--beige-dark);
  border-radius: 8px;
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
}
.pay-qr .qr-label {
  font-size: 14px;
  color: var(--brown);
  font-weight: bold;
}

.pay-form {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  min-width: 280px;
  flex: 1;
  max-width: 380px;
}
.pay-form h3 {
  color: var(--dark-red);
  margin-bottom: 14px;
  font-size: 16px;
}
.form-group {
  margin-bottom: 14px;
}
.form-group label {
  display: block;
  font-size: 13px;
  color: var(--brown);
  margin-bottom: 4px;
  font-weight: bold;
}
.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--beige-dark);
  border-radius: 6px;
  font-size: 14px;
  background: var(--beige-light);
}
.form-group textarea { resize: vertical; min-height: 60px; }
.radio-group {
  display: flex;
  gap: 16px;
}
.radio-group label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: normal;
  cursor: pointer;
}

.pay-header {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  background: var(--brown);
  color: var(--beige-light);
  gap: 10px;
}
.pay-header .back-btn {
  background: rgba(255, 253, 245, 0.15);
  border: none;
  color: var(--beige-light);
  padding: 4px 12px;
  border-radius: 14px;
  font-size: 12px;
  cursor: pointer;
}
.pay-header-title { flex: 1; font-weight: bold; font-size: 16px; }

/* ============ 大厅 Tab 切换 ============ */
.lobby-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--beige-dark);
}
.lobby-tab {
  flex: 1;
  padding: 10px 16px;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: bold;
  color: var(--brown-light);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  position: relative;
}
.lobby-tab.active {
  color: var(--dark-red);
  border-bottom-color: var(--dark-red);
  background: rgba(139, 26, 26, 0.04);
}
.lobby-tab:active { transform: scale(0.97); }

.room-badge {
  display: inline-block;
  background: var(--dark-red);
  color: var(--beige-light);
  font-size: 11px;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  border-radius: 9px;
  padding: 0 5px;
  margin-left: 4px;
  vertical-align: middle;
}

.lobby-tab-content {
  display: none;
}
.lobby-tab-content.active {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* ============ 麻将群 - 活跃房间列表 ============ */
.mg-header {
  margin-bottom: 16px;
}
.mg-title {
  font-size: 16px;
  font-weight: bold;
  color: var(--dark-red);
}
.mg-sub {
  font-size: 12px;
  color: var(--brown-light);
  margin-top: 4px;
}

.mg-room-list {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 4px 16px;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  min-height: 220px;
  align-items: flex-start;
}

.mg-section {
  padding: 4px 8px 0;
  border-bottom: 1px solid var(--beige-dark);
}
.mg-section-title {
  font-size: 12px;
  color: var(--brown-light);
  margin-bottom: 4px;
  font-weight: bold;
}
.mg-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 4px;
  max-height: 180px;
  overflow-y: auto;
}
.mg-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 40px 20px;
  color: var(--brown-light);
  font-size: 15px;
  text-align: center;
}
.mg-empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}
.mg-empty-hint {
  font-size: 12px;
  margin-top: 6px;
  opacity: 0.7;
}

/* 房间卡片 */
.mg-card {
  flex: 0 0 240px;
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(93, 64, 55, 0.15);
  overflow: hidden;
  scroll-snap-align: start;
  border: 2px solid transparent;
  transition: border-color 0.2s, transform 0.15s;
}
.mg-card:active { transform: scale(0.97); }
.mg-card.mg-status-ready { border-color: var(--gold); }
.mg-card.mg-status-playing { border-color: var(--green-felt); opacity: 0.8; }

.mg-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: linear-gradient(135deg, var(--brown), #795548);
  color: var(--beige-light);
}
.mg-card-roomid {
  font-size: 15px;
  font-weight: bold;
  letter-spacing: 1px;
}
.mg-card-status {
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 10px;
  font-weight: bold;
}
.mg-badge-waiting { background: #FFF3CD; color: #856404; }
.mg-badge-ready { background: #D4EDDA; color: #155724; animation: readyPulse 1.5s infinite; }
.mg-badge-playing { background: rgba(255,255,255,0.2); color: var(--beige-light); }

@keyframes readyPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.mg-card-info {
  padding: 10px 14px 6px;
}
.mg-card-creator {
  font-size: 13px;
  font-weight: bold;
  color: var(--brown);
  margin-bottom: 4px;
}
.mg-card-config {
  font-size: 11px;
  color: var(--brown-light);
}

.mg-card-players {
  display: flex;
  gap: 6px;
  padding: 8px 14px;
  flex-wrap: wrap;
}
.mg-player-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 60px;
}
.mg-player-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--beige);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  border: 2px solid var(--gold);
}
.mg-player-empty .mg-player-avatar {
  border-color: var(--beige-dark);
  opacity: 0.5;
}
.mg-player-name {
  font-size: 10px;
  color: var(--brown);
  text-align: center;
  max-width: 64px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mg-player-empty .mg-player-name {
  color: var(--brown-light);
  opacity: 0.6;
}

.mg-card-footer {
  padding: 8px 14px 12px;
}
.mg-btn {
  width: 100%;
  padding: 9px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.1s;
}
.mg-btn:active { transform: scale(0.95); }
.mg-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.mg-btn-start {
  background: linear-gradient(135deg, var(--dark-red), #A52A2A);
  color: var(--beige-light);
}
.mg-btn-join {
  background: linear-gradient(135deg, var(--green-felt), #1B5E3F);
  color: var(--beige-light);
}
.mg-btn-ing {
  background: var(--beige-dark);
  color: var(--brown-light);
}
.mg-btn-full {
  background: var(--beige-dark);
  color: var(--brown-light);
}

/* ============ 响应式：小屏适配 ============ */
@media (max-height: 400px) {
  .login-left .home-title { font-size: 26px; }
  .login-left .home-subtitle { font-size: 12px; }
  .login-box .home-btn { padding: 7px 14px; font-size: 12px; }
  .login-box .home-btn.primary { font-size: 13px; padding: 8px 14px; }
  .login-declare { font-size: 11px; padding: 8px 10px; }
  .tile-hand .mj-tile-svg { width: 46px; height: 68px; }
  .opp-avatar { width: 28px; height: 28px; font-size: 16px; }
  .opp-top { min-height: 80px; }
}

@media (max-width: 500px) {
  /* 竖屏/窄屏时改为上下布局 */
  .login-two-col {
    flex-direction: column;
    gap: 12px;
    padding: 10px 16px;
    max-width: 100%;
  }
  .login-left {
    flex: 0 0 auto;
    max-width: 100%;
    text-align: center;
    padding: 14px 16px 10px;
  }
  .login-left .home-title { font-size: 26px; letter-spacing: 3px; }
  .login-left .home-subtitle { font-size: 13px; margin-bottom: 8px; }
  .login-declare { font-size: 11px; padding: 8px 10px; }
  .login-right {
    flex: 0 0 auto;
    max-width: 100%;
  }
  .login-box { padding: 14px 16px; }
  .login-box .home-btn { padding: 8px 14px; font-size: 12px; }
  .login-box .home-btn.primary { font-size: 13px; padding: 9px 14px; }
  .login-box .login-tip { font-size: 10px; }
  .home-decor { font-size: 50px; }
  .home-decor.d3 { font-size: 35px; }
}

@media (min-width: 800px) {
  body { font-size: 15px; }
  .tile-hand .mj-tile-svg { width: 62px; height: 91px; }
  .login-two-col { gap: 24px; }
  .login-left .home-title { font-size: 38px; }
}

/* ============ 群列表 ============ */
.gl-tip {
  text-align: center;
  padding: 14px 16px;
  margin-bottom: 10px;
  font-size: 14px;
  color: var(--brown);
  background: rgba(201,169,78,0.08);
  border: 1px solid rgba(201,169,78,0.2);
  border-radius: 10px;
}

/* 群列表 - 紧凑列表样式 */
.gl-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.gl-list::-webkit-scrollbar { width: 4px; }
.gl-list::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 4px; }

.gl-item {
  display: flex;
  align-items: center;
  padding: 9px 12px;
  cursor: pointer;
  border-bottom: 1px solid rgba(212,168,67,0.15);
  transition: background 0.15s;
}
.gl-item:hover {
  background: rgba(255,248,230,0.7);
}
.gl-item-name {
  flex: 1;
  font-size: 14px;
  color: var(--dark);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gl-item-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #ccc;
  margin-right: 8px;
  flex-shrink: 0;
}
.gl-item-dot.active { background: #27ae60; box-shadow: 0 0 4px #27ae60; }
.gl-item-join {
  padding: 4px 14px;
  background: linear-gradient(135deg, var(--dark-red), #c0392b);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  margin-left: 8px;
  opacity: 0;
  transition: opacity 0.15s;
}
.gl-item:hover .gl-item-join { opacity: 1; }
.gl-item-join:hover { opacity: 0.9 !important; transform: scale(1.05); }

.gl-empty {
  text-align: center;
  padding: 30px 20px;
  color: var(--brown-light);
  font-size: 13px;
}

/* 群内房间头部 */
.gr-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  padding: 0 4px;
  flex-wrap: wrap;
}
.gr-back-btn {
  padding: 4px 8px;
  background: rgba(255,255,255,0.8);
  border: 1px solid var(--gold);
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  color: var(--brown);
  transition: all 0.2s;
}
.gr-back-btn:hover { background: var(--gold); color: #fff; }
.gr-info {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.gr-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--dark);
}
.gr-id {
  font-size: 11px;
  color: var(--brown-light);
  background: rgba(0,0,0,0.06);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
}
.gr-members {
  font-size: 11px;
  color: var(--brown);
}
/* ============ 群聊消息区 ============ */
.gc-messages {
  flex: 1;
  background: rgba(255,252,240,0.6);
  border: 1px solid rgba(212,168,67,0.3);
  border-radius: 10px;
  padding: 8px;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.gc-messages::-webkit-scrollbar { width: 4px; }
.gc-messages::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 4px; }
.gc-empty {
  text-align: center;
  padding: 20px;
  color: var(--brown-light);
  font-size: 13px;
}
.gc-msg {
  margin-bottom: 12px;
  animation: fadeInUp 0.3s ease;
  flex-shrink: 0;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 房间卡片 */
.rc-sender {
  font-size: 12px;
  color: var(--brown);
  margin-bottom: 6px;
  padding-left: 4px;
}
.rc-time {
  color: var(--brown-light);
  font-size: 11px;
  margin-left: 6px;
}
.rc-card-body {
  background: #fff;
  border: 2px solid var(--gold);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}
.rc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.rc-header td {
  background: linear-gradient(135deg, #f5e6c8, #fdf3d7);
  font-weight: 700;
  color: var(--dark);
  text-align: center;
  padding: 8px 6px;
  border-bottom: 1.5px solid var(--gold);
  font-size: 12px;
  white-space: nowrap;
}
.rc-data td {
  text-align: center;
  padding: 10px 6px;
  border-right: 1px solid #f0e8d0;
  font-size: 13px;
  color: var(--dark);
}
.rc-data td:last-child { border-right: none; }
.rc-player-filled {
  font-weight: 600;
  color: var(--dark);
}
.rc-join-btn {
  padding: 5px 16px;
  background: linear-gradient(135deg, var(--dark-red), #c0392b);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 6px rgba(158,39,38,0.2);
}
.rc-join-btn:hover { opacity: 0.85; transform: scale(1.05); }
.rc-join-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  box-shadow: none;
}
.rc-start-cell {
  background: #fff !important;
  border-left: 1.5px solid var(--gold);
  vertical-align: middle;
  padding: 8px 12px !important;
}
.rc-start-btn {
  padding: 12px 20px;
  background: linear-gradient(135deg, var(--gold), #d4a843);
  color: var(--dark);
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 3px 10px rgba(212,168,67,0.3);
  white-space: nowrap;
}
.rc-start-btn:hover { transform: scale(1.05); box-shadow: 0 4px 14px rgba(212,168,67,0.4); }


/* 紧凑房间卡片 */
.gc-room-card-compact {
  background: #fff;
  border: 1.5px solid var(--gold);
  border-radius: 6px;
  padding: 0;
  margin-bottom: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  flex-shrink: 0;
}
.gc-room-card-compact .rc-hd {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 8px;
  background: linear-gradient(135deg, rgba(245,230,200,0.5), rgba(253,243,215,0.3));
  border-bottom: 1px solid rgba(212,168,67,0.2);
  font-size: 11px;
}
.gc-room-card-compact .rc-hd-l {
  font-weight: 600;
  color: var(--brown);
  white-space: nowrap;
}
.gc-room-card-compact .rc-hd-r {
  display: flex;
  align-items: center;
  gap: 4px;
}
.gc-room-card-compact .rc-rid {
  color: var(--dark-red);
  font-weight: 700;
  font-size: 11px;
  margin-right: 2px;
}
.gc-room-card-compact .rc-btn {
  padding: 2px 7px;
  border: none;
  border-radius: 3px;
  font-size: 10px;
  cursor: pointer;
  white-space: nowrap;
  background: #eee;
  color: #555;
  line-height: 1.4;
}
.gc-room-card-compact .rc-btn:hover { opacity: 0.85; }
.gc-room-card-compact .rc-join { background: var(--dark-red); color: #fff; font-weight: 600; }
.gc-room-card-compact .rc-leave { background: #999; color: #fff; }
.gc-room-card-compact .rc-disband { background: #c0392b; color: #fff; }
.gc-room-card-compact .rc-start { background: #8B1A1A; color: #fff; font-weight: 600; }
.gc-room-card-compact .rc-cfg {
  padding: 2px 8px;
  font-size: 10px;
  color: #888;
  background: rgba(249,249,249,0.5);
}
.gc-room-card-compact .rc-pls {
  display: flex;
  align-items: center;
  padding: 3px 8px 4px;
  gap: 5px;
  flex-wrap: wrap;
}
.gc-room-card-compact .rc-pl {
  padding: 1px 6px;
  background: rgba(212,168,67,0.1);
  border-radius: 3px;
  font-size: 11px;
  color: var(--dark);
  white-space: nowrap;
}
.gc-room-card-compact .rc-pl.rc-me {
  background: rgba(212,168,67,0.25);
  font-weight: 600;
}
.gc-room-card-compact .rc-pl.rc-empty {
  color: #bbb;
  background: transparent;
  border: 1px dashed #ddd;
  font-style: italic;
  font-size: 10px;
}

/* 完整三列房间卡片（群聊开局） */
.gc-room-card {
  background: #fff;
  border: 1.5px solid var(--gold);
  border-radius: 8px;
  padding: 0;
  margin-bottom: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  flex-shrink: 0;
}
.gc-room-card .gc-rc-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 10px;
  background: linear-gradient(135deg, rgba(245,230,200,0.65), rgba(253,243,215,0.35));
  border-bottom: 1px solid rgba(212,168,67,0.25);
}
.gc-room-card .gc-rc-creator {
  font-size: 12px;
  font-weight: 700;
  color: var(--brown);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gc-room-card .gc-rc-rid {
  font-size: 12px;
  font-weight: 700;
  color: var(--dark-red);
}
.gc-room-card .gc-rc-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: stretch;
}
.gc-room-card .gc-rc-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 5px 8px;
}
.gc-room-card .gc-rc-info {
  border-right: 1px solid rgba(212,168,67,0.2);
}
.gc-room-card .gc-rc-players {
  border-right: 1px solid rgba(212,168,67,0.2);
  min-width: 64px;
  max-width: 110px;
}
.gc-room-card .gc-rc-btns {
  min-width: 78px;
  gap: 12px;
  padding: 6px 6px;
}
.gc-room-card .gc-rc-line {
  font-size: 11px;
  color: #666;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gc-room-card .gc-rc-name {
  font-size: 11px;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}
.gc-room-card .gc-rc-name.gc-rc-me {
  font-weight: 700;
  color: var(--brown);
}
.gc-room-card .gc-rc-name.gc-rc-empty {
  color: #bbb;
  font-style: italic;
}
.gc-room-card .gc-rc-btn {
  border: none;
  border-radius: 6px;
  font-size: 13px;
  padding: 11px 8px;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.3;
  width: 100%;
}
.gc-room-card .gc-rc-btn:hover { opacity: 0.88; }
.gc-room-card .gc-rc-btn-join { background: var(--dark-red); color: #fff; font-weight: 600; }
.gc-room-card .gc-rc-btn-leave { background: #999; color: #fff; }
.gc-room-card .gc-rc-btn-disband { background: #c0392b; color: #fff; }
.gc-room-card .gc-rc-btn-start { background: #8B1A1A; color: #fff; font-weight: 600; }
.gc-room-card .gc-rc-btn-ph {
  display: block;
  visibility: hidden;
  font-size: 13px;
  padding: 11px 8px;
  line-height: 1.3;
}

/* 文本消息 */
.gc-text-msg {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 4px 0;
}
.gc-text-msg.gc-self { flex-direction: row-reverse; }
.gc-avatar {
  width: 32px; height: 32px;
  background: var(--gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.gc-bubble {
  background: #fff;
  border: 1px solid #e8e0d0;
  border-radius: 10px;
  padding: 8px 12px;
  max-width: 88%;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.gc-self .gc-bubble {
  background: #fff8e7;
  border-color: var(--gold);
}
.gc-name {
  font-size: 11px;
  color: var(--brown-light);
  margin-bottom: 2px;
}
.gc-text {
  font-size: 13px;
  color: var(--dark);
  line-height: 1.5;
}
.gc-time {
  font-size: 10px;
  color: var(--brown-light);
  text-align: right;
  margin-top: 2px;
}

/* 群内聊天输入栏 */
.gc-input-bar {
  display: flex;
  gap: 6px;
  padding: 4px 0 0;
  flex-shrink: 0;
}
.gc-input-bar input {
  flex: 1;
  padding: 6px 12px;
  border: 1px solid var(--beige-dark);
  border-radius: 18px;
  font-size: 13px;
  background: var(--white);
  outline: none;
}
.gc-input-bar input:focus {
  border-color: var(--gold);
}
.gc-input-bar button {
  padding: 6px 14px;
  background: var(--dark-red);
  color: var(--beige-light);
  border: none;
  border-radius: 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

/* 群内视图 flex 布局 */
#group-room-view {
  display: none !important;
  flex-direction: column;
  height: 100%;
  margin: -20px;
  padding: 8px 12px 60px;
}
#group-room-view.show {
  display: flex !important;
}
/* 群聊视图全宽适配 - 减少内边距 */
#group-room-view .gr-header {
  padding: 8px 8px;
}
#group-room-view .gc-messages {
  padding: 6px 4px;
  flex: 1;
}
#group-room-view .gc-msg {
  max-width: 100% !important;
  width: 100%;
}
#group-room-view .gc-room-card-compact,
#group-room-view .gc-room-card {
  width: 100% !important;
  box-sizing: border-box;
  margin-left: auto;
  margin-right: auto;
}
#group-room-view #room-list-section {
  display: none;
}
#group-list-view {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* ============ 群设置按钮 ============ */
.gr-settings-btn {
  padding: 4px 8px;
  background: linear-gradient(135deg, var(--gold), #B8942F);
  border: none;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  color: #3E2723;
  white-space: nowrap;
  transition: all 0.2s;
  box-shadow: 0 1px 4px rgba(201,169,78,0.3);
}
.gr-settings-btn:hover { transform: scale(1.05); }
.gr-settings-btn:active { transform: scale(0.95); }

/* 清屏按钮 */
.gr-clear-btn {
  padding: 4px 10px;
  background: #c0392b;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.gr-clear-btn:hover { opacity: 0.85; }
.gr-clear-btn:active { transform: scale(0.95); }

/* 结算面板 - 金额显示 */
.settle-money {
  margin: 12px 0;
  padding: 10px 16px;
  background: rgba(201,169,78,0.08);
  border: 1.5px solid var(--gold);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.8;
}
.settle-money-title {
  font-weight: 700;
  color: var(--dark-red);
  margin-bottom: 6px;
  font-size: 14px;
}
.settle-money-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
}
.settle-money-row .arrow { color: var(--gold); font-weight: 700; }
.settle-money-total {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--gold);
  font-weight: 700;
  font-size: 14px;
}

/* 碰杠牌行（显示在手牌上方） */
.my-melds-row {
  display: flex;
  gap: 4px;
  justify-content: center;
  padding: 3px 0;
  min-height: 54px;
  flex-wrap: nowrap;
  overflow: hidden;
}
.my-melds-row .meld {
  display: flex;
  gap: 0;
}
.my-melds-row .meld .mj-tile {
  margin: 0 -2px;
}

/* 缩小上家下家牌 */
.tile-side .mj-tile-svg {
  width: 14px !important;
  height: 22px !important;
}


