/* 双流打牌 · 样式表（重写版，不再叠加补丁）
 * 顶家：头像/名字/张数/牌背 横排居中
 * 左右家：头像/名字/张数/牌背 各占一行，竖排
 * 出牌：摆在各自座位旁边
 */
* { box-sizing: border-box; }

:root {
  --felt-1: #3d5f4a;
  --felt-2: #2b4636;
  --felt-3: #1f3328;
  --felt-line: rgba(255, 255, 255, .12);
  --table-text: #f4ebdd;
  --table-dim: #bfcbbf;
}

html, body {
  margin: 0; min-height: 100%;
  background: var(--vj-bg); color: var(--vj-ink);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
body {
  display: flex; flex-direction: column; gap: 8px;
  padding: 8px 10px 10px; max-width: 860px; margin: 0 auto;
  min-height: 100dvh;
}

/* ---------- 顶栏 ---------- */
.top { display: flex; align-items: center; gap: 8px; }
.top h1 { display: none; }
.voice-btn {
  width: 44px; height: 44px; flex: 0 0 44px;
  border-radius: 50%; border: 2px solid var(--vj-brand-line);
  background: var(--vj-surface); font-size: 22px; line-height: 1;
  display: grid; place-items: center; padding: 0; cursor: pointer;
}
.meta {
  display: flex; gap: 8px; align-items: baseline;
  font-size: 13px; color: var(--vj-side-text-strong);
  white-space: nowrap; overflow: hidden; flex: 1 1 auto;
}
.status { font-weight: 700; color: var(--vj-brand-strong); }
.roomtag { color: var(--vj-brand-strong); font-weight: 700; }
#ledger, #newgame { min-height: 36px; padding: 0 10px; font-size: 13px; border-radius: 10px; }

/* ---------- 牌桌 ---------- */
.table {
  position: relative;
  height: 392px;
  border-radius: 24px;
  background: radial-gradient(ellipse at 50% 30%, var(--felt-1) 0%, var(--felt-2) 55%, var(--felt-3) 100%);
  border: 3px solid #17281f;
  box-shadow: inset 0 0 46px rgba(0,0,0,.45), 0 6px 18px rgba(47,36,27,.18);
  overflow: hidden;
}

/* 座位通用 */
.seat {
  position: absolute;
  display: flex;
  padding: 7px 9px;
  border-radius: 14px;
  background: rgba(0,0,0,.22);
  border: 1.5px solid var(--felt-line);
  color: var(--table-text);
}
.seat.active { border-color: var(--vj-brand); box-shadow: 0 0 0 3px rgba(233,109,76,.35); }
.seat.bao { border-color: var(--vj-accent); }

.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: #fff; border: 2px solid rgba(255,255,255,.45);
  object-fit: cover; flex: 0 0 38px; cursor: pointer;
}
.seat-name { font-size: 13px; font-weight: 700; white-space: nowrap; }
.seat-nums { font-size: 11px; color: var(--table-dim); white-space: nowrap; }
.seat-nums .left { color: var(--table-text); margin-right: 6px; }
.backs { display: flex; }
.backs i {
  display: block; width: 9px; height: 13px; border-radius: 2px;
  border: 1px solid rgba(255,255,255,.55);
  background: repeating-linear-gradient(45deg, #E96D4C 0 3px, #D55A38 3px 6px);
  margin-left: -4px;
}
.backs i:first-child { margin-left: 0; }
.backs .more { font-size: 10px; color: var(--table-dim); margin-left: 3px; }

/* 顶家：横排居中 */
.seat-top {
  top: 8px; left: 50%; transform: translateX(-50%);
  flex-direction: row; align-items: center; gap: 10px;
  max-width: 94%;
}
.seat-top .who { display: flex; flex-direction: row; align-items: center; gap: 6px; }

/* 左右家：逐行竖排 */
.seat-left, .seat-right {
  top: 128px;
  flex-direction: column; align-items: center; gap: 4px;
  width: 64px;
  padding: 5px 2px;
}
.seat-left { left: 0; }
.seat-right { right: 0; }
.seat-left .who, .seat-right .who {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.seat-left .seat-nums, .seat-right .seat-nums { display: block; text-align: center; }
.seat-left .seat-nums .left, .seat-right .seat-nums .left { display: block; margin: 0; }
.seat-left .avatar, .seat-right .avatar { width: 30px; height: 30px; flex: 0 0 30px; }
.seat-left .seat-name, .seat-right .seat-name { font-size: 11px; }
.seat-left .seat-nums, .seat-right .seat-nums { font-size: 10px; }
.seat-left .backs i, .seat-right .backs i { width: 8px; height: 11px; margin-left: -4px; }
.seat-left .backs, .seat-right .backs { justify-content: center; }

/* 各家出的牌 */
.pcol {
  position: absolute;
  display: flex; flex-direction: column; gap: 2px;
  pointer-events: none;
}
.pcol-top { top: 66px; left: 50%; transform: translateX(-50%); align-items: center; }
.pcol-left { top: 128px; left: 72px; align-items: flex-start; }
.pcol-right { top: 180px; right: 72px; align-items: flex-end; }
.play-who { font-size: 10px; color: var(--table-dim); height: 12px; }
.pcol .slot { display: flex; gap: 2px; min-height: 40px; }
.pcol .slot .card { width: 28px; height: 40px; }

/* 中央提示 */
.center {
  position: absolute;
  left: 66px;
  top: 186px;
  width: 128px;
  text-align: center;
  font-size: 12px; font-weight: 600;
  color: var(--table-text);
  opacity: .9;
  pointer-events: none;
}

/* 我出的牌 */
.slot-me {
  position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%);
  display: flex; align-items: center; justify-content: center; gap: 4px;
  height: 58px;
}
.slot-me .card { width: 40px; height: 56px; }

/* ---------- 扑克牌 ---------- */
.card {
  position: relative;
  background: #fdfcf9;
  border: 1.5px solid #d9d0c3;
  border-radius: 7px;
  flex: 0 0 auto;
  user-select: none;
  box-shadow: 0 2px 0 rgba(0,0,0,.12);
}
.card .c-r { position: absolute; top: 3px; left: 4px; font-size: 19px; font-weight: 800; line-height: 1; }
.card .c-s { position: absolute; top: 22px; left: 5px; font-size: 14px; line-height: 1; }
.card .pip { position: absolute; right: 5px; bottom: 4px; font-size: 22px; line-height: 1; opacity: .85; }
.card.red { color: #cf3a24; }
.card.black { color: #24211d; }

.pcol .card { border-radius: 4px; border-width: 1px; }
.pcol .card .c-r { font-size: 11px; top: 1px; left: 2px; }
.pcol .card .c-s { font-size: 9px; top: 14px; left: 2px; }
.pcol .card .pip { display: none; }
.slot-me .card .c-r { font-size: 14px; }
.slot-me .card .c-s { font-size: 11px; top: 17px; }
.slot-me .card .pip { font-size: 16px; }

.pass-chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 44px; padding: 0 8px;
  border-radius: 8px; background: rgba(0,0,0,.35);
  border: 1.5px dashed rgba(255,255,255,.35);
  color: var(--table-dim); font-size: 14px; font-weight: 700;
}
.pcol .pass-chip { height: 40px; min-width: 28px; font-size: 12px; }

/* ---------- 我的区域 ---------- */
.mine {
  background: var(--vj-surface);
  border: 2px solid var(--vj-brand-line);
  border-radius: 18px;
  padding: 8px 10px 10px;
}
.me-head { display: flex; align-items: center; gap: 8px; }
.me-avatar { width: 38px; height: 38px; }
.me-meta { display: flex; flex-direction: column; line-height: 1.2; }
.me-name { font-size: 16px; font-weight: 700; }
.me-stat { font-size: 12px; color: var(--vj-side-text-strong); }
.hint-text { margin-left: auto; font-size: 12px; color: var(--vj-accent-strong); text-align: right; max-width: 58%; }

.hand-wrap { position: relative; height: 92px; margin-top: 4px; }
.hand { position: absolute; inset: 0; }
.hand .card {
  position: absolute; left: 50%; top: 6px;
  width: 56px; height: 80px; margin-left: -28px;
  cursor: pointer;
  transition: transform .1s;
}
.hand .card.sel { outline: 3px solid var(--vj-brand); outline-offset: -1px; }
.hand .card.tip { outline: 3px solid var(--vj-accent); outline-offset: -1px; }

.actions { display: flex; gap: 8px; margin-top: 4px; }
.actions .btn { flex: 1; }

/* ---------- 按钮 ---------- */
.btn {
  min-height: 50px; padding: 0 12px;
  font-size: 18px; font-weight: 700; letter-spacing: 1px;
  border-radius: 12px; border: 2px solid var(--vj-line-strong);
  background: var(--vj-surface); color: var(--vj-ink);
  cursor: pointer; white-space: nowrap;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--vj-brand); border-color: var(--vj-brand); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--vj-brand-line); color: var(--vj-side-text-strong); }

/* ---------- 弹层 ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(31,51,40,.55);
  display: flex; align-items: center; justify-content: center;
  padding: 16px; z-index: 300;
}
.overlay[hidden] { display: none; }
.panel {
  background: var(--vj-surface); border-radius: 20px;
  padding: 22px 22px 26px; width: 100%; max-width: 420px;
  max-height: 90dvh; overflow-y: auto; text-align: center;
}
.panel h2 { margin: 0 0 10px; font-size: 24px; color: var(--vj-brand-deep); }
.panel .lead { margin: 0 0 16px; color: var(--vj-side-text-strong); font-size: 16px; }
.panel .tip { margin: 12px 0 0; font-size: 15px; color: var(--vj-side-text); }
.panel .row {
  display: flex; justify-content: space-between; gap: 24px;
  font-size: 19px; padding: 8px 0; border-bottom: 1px solid var(--vj-line);
}
.panel .row.me { color: var(--vj-brand-strong); font-weight: 700; }
.block { display: block; width: 100%; margin-top: 10px; }
.input {
  min-height: 50px; width: 100%; padding: 0 12px;
  font-size: 20px; border-radius: 12px;
  border: 2px solid var(--vj-line-strong); background: #fff; color: var(--vj-ink);
  text-align: center; letter-spacing: 6px;
}
.input::placeholder { letter-spacing: 0; color: var(--vj-side-text); font-size: 16px; }
.join-row { display: flex; gap: 8px; margin-top: 10px; align-items: stretch; }
.join-row .input { flex: 1; }
.code { color: var(--vj-brand-strong); letter-spacing: 6px; font-size: 28px; }
.seat-list { margin: 14px 0; }
.seat-row {
  display: flex; justify-content: space-between; padding: 9px 4px;
  border-bottom: 1px solid var(--vj-line); font-size: 17px;
}
.seat-row.me { color: var(--vj-brand-strong); font-weight: 700; }
.tag { font-size: 14px; color: var(--vj-side-text); }

/* 违规结算 */
.violation {
  margin: 12px 0 4px; padding: 12px 14px; border-radius: 14px;
  background: var(--vj-danger-soft); border: 2px solid var(--vj-danger); text-align: left;
}
.v-title { font-size: 19px; font-weight: 800; color: var(--vj-danger); margin-bottom: 6px; }
.v-body { font-size: 16px; color: var(--vj-ink); line-height: 1.5; }
.v-foot { font-size: 14px; color: var(--vj-side-text-strong); margin-top: 6px; }

/* ---------- 特效 ---------- */
@keyframes bombShake {
  0%,100% { transform: translate(0,0) }
  20% { transform: translate(-6px,3px) } 40% { transform: translate(6px,-3px) }
  60% { transform: translate(-4px,-2px) } 80% { transform: translate(4px,2px) }
}
.table.shake { animation: bombShake .45s ease-in-out; }
@keyframes bombPop {
  0% { transform: scale(.4); opacity: 0 } 35% { transform: scale(1.15); opacity: 1 }
  70% { transform: scale(1); opacity: 1 } 100% { transform: scale(1.4); opacity: 0 }
}
.bomb-fx { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 5; }
.bomb-fx span {
  font-size: 50px; font-weight: 900; letter-spacing: 6px; color: #fff;
  text-shadow: 0 0 14px #FF6A2B, 0 0 30px #E96D4C, 0 4px 10px rgba(0,0,0,.6);
  animation: bombPop .7s ease-out forwards;
}
.bomb-fly {
  position: fixed; width: 44px; height: 44px; font-size: 40px; line-height: 44px;
  text-align: center; z-index: 260; pointer-events: none;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,.5));
  transition: transform 1.25s cubic-bezier(.3,.7,.6,1);
}
.fly-layer { position: fixed; inset: 0; pointer-events: none; z-index: 250; }
.fly-card {
  position: absolute; width: 18px; height: 26px; border-radius: 3px;
  border: 1px solid rgba(255,255,255,.7);
  background: repeating-linear-gradient(45deg, #E96D4C 0 3px, #D55A38 3px 6px);
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
  transition: transform .55s cubic-bezier(.4,.1,.6,1), opacity .55s;
}
@keyframes plusUp {
  0% { transform: translateY(6px) scale(.6); opacity: 0 }
  30% { transform: translateY(0) scale(1.1); opacity: 1 }
  100% { transform: translateY(-26px) scale(1); opacity: 0 }
}
.fly-plus {
  position: absolute; font-size: 24px; font-weight: 900; color: var(--vj-accent-strong);
  text-shadow: 0 2px 6px rgba(0,0,0,.45); animation: plusUp 1s ease-out forwards;
}

/* ---------- 大屏 ---------- */
@media (min-width: 700px) {
  .table { height: 440px; }
  .seat-left, .seat-right { width: 110px; }
  .pcol-top { top: 76px; }
  .pcol-left { left: 134px; }
  .pcol-right { right: 134px; }
  .hand-wrap { height: 108px; }
  .hand .card { width: 66px; height: 94px; margin-left: -33px; }
}

/* 出牌处不再显示名字 */
.play-who { display: none !important; }

/* 微信式爆炸特效（无文字） */
.boom { position: fixed; z-index: 255; pointer-events: none; }
.boom-flash {
  position: absolute; left: -60px; top: -60px;
  width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.95) 0%, rgba(255,190,120,.85) 35%, rgba(233,109,76,0) 70%);
  animation: boomFlash .45s ease-out forwards;
}
@keyframes boomFlash {
  0% { transform: scale(.3); opacity: 0 }
  25% { transform: scale(1); opacity: 1 }
  100% { transform: scale(2.4); opacity: 0 }
}
.boom-ring {
  position: absolute; left: -30px; top: -30px;
  width: 60px; height: 60px; border-radius: 50%;
  border: 3px solid rgba(255, 214, 170, .95);
  animation: boomRing .7s ease-out forwards;
}
@keyframes boomRing {
  0% { transform: scale(.3); opacity: .95 }
  100% { transform: scale(3.4); opacity: 0 }
}
.boom-spark {
  position: absolute; left: -3px; top: -3px;
  width: 6px; height: 6px; border-radius: 50%;
  background: #FFB15E;
  box-shadow: 0 0 8px #FF7A2B;
  animation: boomSpark .75s ease-out forwards;
}
@keyframes boomSpark {
  0% { transform: translate(0,0) scale(1); opacity: 1 }
  100% { transform: translate(var(--dx), var(--dy)) scale(.3); opacity: 0 }
}

/* 火球 + 黑烟 */
.boom-fire {
  position: absolute; border-radius: 50%;
  background: radial-gradient(circle, #FFFBD6 0%, #FFE066 22%, #FFA32B 45%, #E8461B 68%, rgba(180,40,10,0) 80%);
  filter: blur(7px);
  animation: fireExpand .85s cubic-bezier(.2,.7,.4,1) forwards;
}
@keyframes fireExpand {
  0% { transform: scale(.15) rotate(0deg); opacity: 0 }
  18% { opacity: 1 }
  60% { transform: scale(1.5) rotate(20deg); opacity: .95 }
  100% { transform: scale(2.3) rotate(35deg); opacity: 0 }
}
.boom-smoke {
  position: absolute; border-radius: 50%;
  background: radial-gradient(circle, rgba(70,70,70,.55) 0%, rgba(50,50,50,.35) 45%, rgba(40,40,40,0) 72%);
  filter: blur(10px);
  animation: smokeRise 1.3s ease-out forwards;
}
@keyframes smokeRise {
  0% { transform: scale(.5) translateY(0); opacity: 0 }
  25% { opacity: .8 }
  100% { transform: scale(1.7) translateY(-26px); opacity: 0 }
}

/* 提示语跟着左家的牌走：贴在其下方、随牌宽居中 */
.pcol-left { align-items: stretch !important; }
.pcol-left .pot-label {
  display: block;
  margin-top: 4px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--table-text);
  opacity: .85;
  white-space: nowrap;
}
.center { display: none !important; }

/* 提示语：位于右家出牌下方，整宽居中 */
.center {
  display: block !important;
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  top: 228px !important;
  transform: none !important;
  width: auto !important;
  text-align: center;
  pointer-events: none;
}
.center .pot-label {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: var(--table-text);
  opacity: .85;
  white-space: nowrap;
}

/* 牌逐张出现（用独立 translate 属性，不干扰手牌的 transform 定位） */
@keyframes cardIn {
  0%   { opacity: 0; translate: 0 -16px; filter: blur(1px); }
  100% { opacity: 1; translate: 0 0; filter: blur(0); }
}
.card.in { animation: cardIn .42s ease-out both; }

.ledger-h {
  margin: 14px 0 6px;
  font-size: 13px;
  color: var(--vj-side-text);
  text-align: left;
}

/* 微信浏览器兼容：老内核不支持 flex gap，用 margin 兜底 */
.seat-top .who { margin-right: 8px; flex: 0 0 auto; }
.seat-top .seat-name { flex: 0 0 auto; white-space: nowrap; }
.seat-top .seat-nums {
  margin-right: 8px;
  flex: 0 0 auto;
  white-space: nowrap;
  display: flex;
  gap: 0;
}
.seat-top .seat-nums .left { margin-right: 8px; }
.seat-top .backs { flex: 0 0 auto; }
.seat-top { flex-wrap: nowrap; align-items: center; max-width: 96%; }

/* 顶家：牌背不越框 */
.seat-top { overflow: hidden; }
.seat-top .backs {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  justify-content: flex-start;
}
.seat-top .backs .more { flex: 0 0 auto; }

/* 顶家牌背：允许完整显示，但最多 4 张，不会越框 */
.seat-top { overflow: visible; }
.seat-top .backs { overflow: visible; }

/* 顶家横条拉通整个桌面宽度，牌背不再被挤 */
.seat-top {
  left: 8px !important;
  right: 8px !important;
  transform: none !important;
  width: auto !important;
  max-width: none !important;
  justify-content: center !important;
  overflow: visible !important;
}
.seat-top .backs {
  flex: 0 0 auto !important;
  overflow: visible !important;
}

/* 赢 / 剩 之间拉开距离，牌背不再跟数字 */
.seat-top .seat-nums .left { margin-left: 14px; }
.seat-left .seat-nums .left,
.seat-right .seat-nums .left { margin-top: 6px; }
.seat-nums { line-height: 16px; }
