/* 斗地主、掼蛋的牌桌（ADR-0177：好玩、可爱、让人想坐下）：暖灯照着的木头牌桌、真绒布、每人一把小椅子，
   卡通形象坐在椅子上，出牌飞到桌上，赢了撒彩带。桌布、牌背还是 games.css 里那几种。网站和原型是同一份 */

/* ---------- 桌子：木边、灯光 ---------- */
.gs-table {
  position: relative;
  margin: 10px -4px 0;
  padding: 12px;
  border-radius: 40px;
  background:
    repeating-linear-gradient(97deg, rgba(255, 236, 205, 0.05) 0 3px, rgba(40, 18, 6, 0.06) 3px 8px),
    linear-gradient(#94592f, #6a3c1c 55%, #54301a);
  box-shadow: inset 0 2px 0 rgba(255, 220, 180, 0.35), inset 0 -4px 8px rgba(0, 0, 0, 0.35), 0 0 0 1px #3b2212,
    0 18px 30px rgba(70, 36, 12, 0.35);
}

/* 桌子后面一圈暖暖的灯光 */
.gs-table::after {
  content: "";
  position: absolute;
  inset: -36px -20px -10px;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 40%, rgba(255, 196, 120, 0.42), rgba(255, 196, 120, 0) 70%);
  pointer-events: none;
}

.gs-table .gfelt {
  min-height: 318px;
  padding: 18px 10px 14px;
  border: 0;
  border-radius: 30px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25), inset 0 0 36px rgba(0, 0, 0, 0.45), inset 0 8px 18px rgba(0, 0, 0, 0.25);
}

/* 头顶的灯照在绒布上 */
.gs-table .gfelt::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  background: radial-gradient(ellipse 70% 55% at 50% 38%, rgba(255, 236, 190, 0.22), rgba(255, 236, 190, 0) 70%);
  pointer-events: none;
}

/* 绒布边上一圈缝线 */
.gs-table .gfelt::after {
  content: "";
  position: absolute;
  inset: 7px;
  z-index: 0;
  border: 1.5px dashed rgba(255, 240, 210, 0.26);
  border-radius: 24px;
  pointer-events: none;
}

.gs-table .gfelt > :not(.g-result) { position: relative; z-index: 1; }
.gs-table .gfelt.cloth-paper::after { border-color: rgba(90, 60, 30, 0.25); }

/* ---------- 座位：椅子、形象、名字 ---------- */
.gs-table .g-seat {
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 4px;
  text-align: center;
}

.gs-table .g-seat.right { text-align: center; }

.gs-table .g-who,
.gs-table .g-seat.right .g-who {
  flex-direction: column;
  gap: 15px;
}

/* 顶上：返回、我有多少筹码、喇叭 */
#view-table > .top, #view-gomoku > .top { gap: 10px; }
#view-table > .top .table-chips, #view-gomoku > .top .table-chips { margin-left: auto; }
#view-table > .top .gx-sound, #view-gomoku > .top .gx-sound { margin-left: 0; }

.gs-table .g-face {
  z-index: 0;
  width: 56px;
  height: 56px;
  isolation: isolate;
}

/* 椅背：每个座位一把软软的小椅子 */
.gs-table .g-face::before {
  content: "";
  position: absolute;
  left: -9px;
  right: -9px;
  top: -5px;
  bottom: -12px;
  z-index: -1;
  border-radius: 26px 26px 14px 14px;
  background: linear-gradient(#c45a3c, #8e3522);
  box-shadow: inset 0 2px 0 rgba(255, 200, 170, 0.45), 0 4px 8px rgba(0, 0, 0, 0.35);
}

.gs-table .g-seat.right .g-face::before { background: linear-gradient(#4f8fc4, #2e5f8e); }
.gs-table .g-seat.top .g-face::before { background: linear-gradient(#5aa57e, #326c4d); }
.gs-table .g-mine .g-face::before { background: linear-gradient(#e2a63c, #a8701c); }

.gs-table .g-face .gx-face,
.gs-table .g-face .ofit { width: 56px; height: 56px; }

.gs-table .g-face .avatar {
  width: 56px;
  height: 56px;
  box-shadow: 0 0 0 3px #fffaf0, 0 3px 6px rgba(0, 0, 0, 0.35);
}

.gs-table .g-seat.turn .g-face .avatar,
.gs-table .g-mine.turn .g-face .avatar {
  box-shadow: 0 0 0 3px #fffaf0, 0 0 0 6px #f2b33d, 0 0 18px 6px rgba(242, 179, 61, 0.6);
  animation: cs-turn 1.2s ease-in-out infinite;
}

@keyframes cs-turn {
  50% { box-shadow: 0 0 0 3px #fffaf0, 0 0 0 7px #ffd36a, 0 0 26px 10px rgba(242, 179, 61, 0.75); }
}

.gs-table .g-name,
.gs-table .g-seat.right .g-name {
  justify-items: center;
  gap: 3px;
}

.gs-table .g-name > b {
  max-width: 96px;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.94);
  color: #2a221d;
  font-size: 13px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.gs-table .g-name .tag { padding: 1px 7px; font-size: 11px; }
.gs-table .g-name .kb { font-size: 11px; }

/* 地主戴一顶小金冠（在形象左上角） */
.gs-table .g-face .lord-mark {
  position: absolute;
  left: -8px;
  top: -10px;
  z-index: 5;
  width: 24px;
  height: 18px;
  background: #ffcf3f;
  clip-path: polygon(0 100%, 6% 20%, 30% 55%, 50% 0, 70% 55%, 94% 20%, 100% 100%);
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.45));
}

/* 还剩几张：一小叠扣着的牌 + 数字 */
.gs-table .g-left,
.gs-table .g-seat.right .g-left,
.gs-table .g-seat.top .g-left { justify-content: center; margin-top: 2px; }

.gs-table .g-left .gc.tiny {
  width: 15px;
  height: 21px;
  box-shadow: inset 0 0 0 1.5px #fffcf7, 3px -2px 0 -0.5px #fffcf7, 3px -2px 0 0.5px rgba(0, 0, 0, 0.25), 6px -4px 0 -0.5px #fffcf7,
    6px -4px 0 0.5px rgba(0, 0, 0, 0.25);
}

.gs-table .g-left > span:last-child {
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.3);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.gs-table .g-left .warn {
  background: #e0543f !important;
  color: #fff !important;
  animation: cs-warn 0.9s ease-in-out infinite;
}

@keyframes cs-warn {
  50% { transform: scale(1.12); }
}

/* 说的话（不要、叫 2 分）：白色小泡泡，尾巴朝着人 */
.gs-table .g-play,
.gs-table .g-seat.right .g-play,
.gs-table .g-seat.top .g-play {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 46px;
  margin-top: 4px;
}

.gs-table .g-say {
  position: relative;
  padding: 3px 11px;
  border-radius: 14px;
  background: #fffaf0;
  color: #2a221d;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.gs-table .g-say::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -5px;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  background: #fffaf0;
  transform: rotate(45deg);
  border-radius: 2px;
}

.gs-table .g-mine .g-say::after { top: auto; bottom: -5px; }

/* 刚出的牌从这个人那边飞到桌上 */
.gs-table .g-play { --fx: 0px; --fy: -34px; --fr: 0deg; }
.gs-table .g-seat.left .g-play { --fx: -30px; --fy: -40px; --fr: -16deg; }
.gs-table .g-seat.right .g-play { --fx: 30px; --fy: -40px; --fr: 16deg; }
.gs-table .g-mine .g-play { --fx: 0px; --fy: 90px; --fr: 0deg; }

.gs-table .g-play.fresh > * { animation: cs-fly 360ms cubic-bezier(.2, .9, .3, 1.25) both; }

@keyframes cs-fly {
  from { transform: translate(var(--fx), var(--fy)) rotate(var(--fr)) scale(0.55); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* ---------- 桌子中间：底牌、倍数、打几 ---------- */
.gs-table .g-center { gap: 7px; padding-top: 10px; }

.gs-table .g-mult {
  padding: 3px 12px;
  border-radius: 10px;
  background: linear-gradient(#9a6236, #643b1d);
  color: #ffe9c4;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  box-shadow: inset 0 1px 0 rgba(255, 220, 180, 0.45), 0 2px 4px rgba(0, 0, 0, 0.35);
}

.gs-table .g-sub { line-height: 1.4; }
.gs-table .bottom-cards { gap: 4px; }

/* ---------- 牌面：白底、角上写点数，中间一个大花色 ---------- */
.gs-table .gc,
.ghand .gc {
  background: linear-gradient(#fffefa, #f5eee1);
  box-shadow: inset 0 0 0 1px #ddd2bf, 0 1px 2px rgba(0, 0, 0, 0.3);
}

.gs-table .gc.back,
.ghand .gc.back { box-shadow: inset 0 0 0 2px #fffcf7, 0 1px 2px rgba(0, 0, 0, 0.3); }

/* 扣着的牌和顶上「返回」都叫 .back：网站的 home.css 给「返回」画的箭头、挪的位置别画到牌背上 */
.gc.back { margin-left: 0; gap: 0; font-size: inherit; }
.gc.back::before { content: none !important; display: none !important; }

.gs-table .gc.mini {
  width: 30px;
  height: 42px;
}

.gs-table .gc.joker b,
.ghand .gc.joker b { color: inherit; }

.ghand .gc.hand-card {
  --rot: 0deg;
  --dy: 0px;
  transform: translateY(var(--dy)) rotate(var(--rot));
  transform-origin: 50% 130%;
  box-shadow: inset 0 0 0 1px #d8ccb8, -2px 3px 6px rgba(26, 24, 20, 0.16);
  transition: transform 180ms cubic-bezier(.3, 1.5, .5, 1);
}

/* 中间一个大花色（王是一颗星） */
.ghand .gc.hand-card::after {
  content: attr(data-pip);
  position: absolute;
  right: 6px;
  bottom: 5px;
  font-size: 22px;
  line-height: 1;
  opacity: 0.9;
}

.ghand .gc.hand-card.joker::after { content: "★"; color: #f2b33d; }
.ghand .gc.hand-card.joker.red::after { color: #e0543f; }

.ghand .gc.hand-card.picked {
  transform: translateY(calc(var(--dy) - 18px)) rotate(var(--rot));
  box-shadow: inset 0 0 0 2px #2a221d, 0 8px 14px rgba(26, 24, 20, 0.25);
}

/* 发牌：一张张从桌上飞到手里 */
.ghand.dealing .gc.hand-card { animation: cs-deal 420ms cubic-bezier(.2, .8, .3, 1.1) both; animation-delay: calc(var(--k) * 24ms); }

@keyframes cs-deal {
  from { transform: translate(var(--from), -160px) rotate(-30deg) scale(0.5); opacity: 0; }
  to { transform: translateY(var(--dy)) rotate(var(--rot)); opacity: 1; }
}

/* ---------- 一局打完 ---------- */
.gs-table .g-result { animation: cs-pop 380ms cubic-bezier(.2, 1.4, .4, 1) both; }

@keyframes cs-pop {
  from { transform: translateY(24px) scale(0.9); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.gs-table .g-result.won { box-shadow: 0 0 0 3px #f2b33d, 0 12px 30px rgba(26, 24, 20, 0.3); }

.gs-table .g-result.won::before,
.gs-table .g-result.lost::before {
  position: absolute;
  right: 12px;
  top: -14px;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

.gs-table .g-result.won::before { content: "赢啦"; background: linear-gradient(#ffd96a, #f2b33d); color: #6b4a0c; }
.gs-table .g-result.lost::before { content: "下一局加油"; background: #e8eef7; color: #4a5f7f; }

@media (max-width: 360px) {
  .gs-table { padding: 9px; border-radius: 32px; }
  .gs-table .g-face, .gs-table .g-face .avatar, .gs-table .g-face .gx-face, .gs-table .g-face .ofit { width: 48px; height: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  .gs-table .g-seat.turn .g-face .avatar, .gs-table .g-mine.turn .g-face .avatar,
  .gs-table .g-left .warn, .gs-table .g-play.fresh > *, .ghand.dealing .gc.hand-card, .gs-table .g-result { animation: none; }
  .ghand .gc.hand-card { transition: none; }
}

/* ---------- 未满 18 周岁的游戏页：只有五子棋（ADR-0174 后续） ---------- */
.kid-only { display: none; }
.kid-mode .kid-only { display: block; }
.kid-mode .adult-only { display: none !important; }
body.kid-mode.with-dock main { padding-bottom: 40px; }
.kid-time { display: grid; gap: 4px; border: 1px solid var(--line); }
.kid-time b { font-size: 17px; }
.kid-time p { margin: 0; font-size: 14px; line-height: 1.5; }
.kid-time .muted { color: var(--muted); font-size: 13px; }
.kid-time.open { border-color: #9cc79a; background: #f1f8ee; }
.btn.off { opacity: 0.45; pointer-events: none; }
