/* 哥们打大A · 横屏 16:9 牌桌 */
:root {
  --orange: #FF8A3D;
  --orange-deep: #D9621A;
  --gold: #FFC947;
  --gold-deep: #E8A62A;
  --ink: #2A1B0E;
  --ink-soft: #6B5844;
  --cream: #FFF8EC;
  --red: #D6473A;
  --green: #1C6B4A;
  --stage-w: 1280px;
  --stage-h: 720px;
}
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0B0704;
  color: var(--cream);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button {
  font: inherit;
  color: inherit;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
}
button:disabled { cursor: default; }
.hidden { display: none !important; }

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: radial-gradient(circle at 50% 30%, #2A160C, #070403 70%);
}
#stage {
  position: relative;
  flex: none;
  width: var(--stage-w);
  height: var(--stage-h);
  transform: scale(var(--stage-scale, 1));
  transform-origin: center center;
  overflow: hidden;
  border-radius: 2px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .65);
  background: #2A160C;
}
#scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  pointer-events: none;
}
.scene-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(20, 8, 3, .58) 0%, rgba(20, 8, 3, .12) 15%, rgba(20, 8, 3, 0) 28%, rgba(20, 8, 3, 0) 50%, rgba(16, 7, 3, .20) 58%, rgba(14, 7, 3, .60) 64%, rgba(12, 5, 2, .96) 70%, rgba(10, 5, 2, 1) 74%, rgba(8, 3, 1, 1) 100%),
    radial-gradient(ellipse at 50% 47%, rgba(16, 7, 3, .16) 0%, transparent 56%),
    radial-gradient(ellipse at 50% 55%, transparent 40%, rgba(10, 5, 2, .46) 100%);
}

/* 顶部状态 */
.hud {
  position: absolute;
  z-index: 20;
  left: 18px;
  right: 18px;
  top: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.hud > * { pointer-events: auto; }
.hud-btn {
  width: 48px;
  height: 48px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(38, 18, 8, .58);
  border: 1px solid rgba(255, 220, 160, .35);
  color: #FFE9C9;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .22);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.hud-btn:active { background: rgba(255, 170, 80, .28); transform: translateY(1px); }
.hud-btn .mp-icon { width: 24px; height: 24px; }
.hud-chip {
  height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 13px;
  border-radius: 12px;
  background: rgba(38, 18, 8, .58);
  border: 1px solid rgba(255, 220, 160, .3);
  color: #FFE9C9;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: .02em;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.hud-chip .mp-icon { width: 18px; height: 18px; opacity: .9; }
.count-chip { min-width: 58px; justify-content: center; }
.mult-chip {
  min-width: 92px;
  justify-content: center;
  background: linear-gradient(180deg, rgba(255, 188, 82, .95), rgba(222, 108, 24, .95));
  border-color: #FFE0A1;
  color: #2A1305;
  box-shadow: 0 3px 0 rgba(110, 45, 5, .45);
}
.mult-chip.solo {
  background: linear-gradient(180deg, #FFE28A, #FF9A2E);
  color: #3A1600;
  box-shadow: 0 0 16px rgba(255, 170, 50, .6), 0 3px 0 rgba(110, 45, 5, .45);
}
.mult-chip.hidden-mult { background: rgba(38, 18, 8, .6); color: #FFD89A; }
.clock-chip { min-width: 92px; justify-content: center; }
.clock-chip.warn { color: #FF9E82; border-color: rgba(255, 110, 80, .55); }
.hud-right { margin-left: auto; display: flex; gap: 8px; }

/* 座位 */
.seats { position: absolute; inset: 0; z-index: 15; pointer-events: none; }
.seat {
  position: absolute;
  width: 208px;
  height: 62px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border-radius: 15px;
  background: linear-gradient(180deg, rgba(41, 20, 10, .8), rgba(22, 9, 4, .78));
  border: 1px solid rgba(255, 218, 160, .28);
  box-shadow: 0 5px 16px rgba(0, 0, 0, .32);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.seat.active {
  border-color: rgba(255, 190, 72, .9);
  box-shadow: 0 0 0 2px rgba(255, 190, 72, .22), 0 0 26px rgba(255, 160, 40, .38);
  transform: translateY(-2px);
}
.seat.finished { opacity: .48; }
.seat-left-top { left: 18px; top: 132px; }
.seat-left-mid { left: 18px; top: 330px; }
.seat-right-top { right: 18px; top: 132px; }
.seat-right-mid { right: 18px; top: 330px; }
.seat-avatar {
  position: relative;
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(255, 224, 170, .7);
  background-color: #F4D9B6;
  background-image: url(images/avatars/seat0.png);
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  box-shadow: inset 0 0 0 1px rgba(70, 35, 10, .25);
}
.av-0 { background-image: url(images/avatars/seat0.png); }
.av-1 { background-image: url(images/avatars/seat1.png); }
.av-2 { background-image: url(images/avatars/seat2.png); }
.av-3 { background-image: url(images/avatars/seat3.png); }
.av-4 { background-image: url(images/avatars/seat4.png); }
.role-badge {
  position: absolute;
  right: -1px;
  bottom: -1px;
  min-width: 23px;
  height: 18px;
  padding: 0 4px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
  border: 1px solid rgba(255, 255, 255, .45);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
}
.role-badge.gold { background: linear-gradient(180deg, #FFE18A, #FFB23E); color: #4A2400; }
.role-badge.enemy { background: linear-gradient(180deg, #F26B5B, #B92218); color: #FFF4EC; }
.role-badge.me { background: rgba(255, 255, 255, .16); color: #FFE9C9; }
.seat-main { min-width: 0; flex: 1; }
.seat-name {
  color: #FFF2DA;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.seat-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
  color: rgba(255, 236, 205, .68);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.seat-meta .mp-icon { width: 12px; height: 12px; opacity: .7; flex: none; }
.seat-last { color: #FFC98A; }
.seat-turn-tag {
  flex: none;
  padding: 3px 6px;
  border-radius: 6px;
  background: rgba(255, 190, 72, .2);
  border: 1px solid rgba(255, 190, 72, .5);
  color: #FFD36A;
  font-size: 9px;
  font-weight: 900;
}

/* 桌面中央 */
.table-wrap {
  position: absolute;
  left: 50%;
  top: 344px;
  width: 420px;
  min-height: 150px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 12;
  pointer-events: none;
}
.table-cards {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 96px;
  padding: 0 30px;
}
.table-cards .card {
  margin-left: -18px;
  box-shadow: 0 5px 12px rgba(0, 0, 0, .36);
}
.table-cards .card:first-child { margin-left: 0; }
.table-status {
  margin-top: 4px;
  padding: 4px 13px;
  border-radius: 999px;
  background: rgba(26, 12, 6, .66);
  border: 1px solid rgba(255, 218, 160, .22);
  color: #FFE3BB;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  max-width: 400px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.clock-orb {
  position: absolute;
  left: 861px;
  top: 372px;
  z-index: 13;
  width: 82px;
  height: 82px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 30%, #6a3d13, #1c0d04 72%);
  border: 3px solid #C6923C;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, .5), 0 4px 14px rgba(0, 0, 0, .35);
  color: #FFE2A6;
  font-size: 27px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.clock-orb.warn { color: #FF9C82; border-color: #D74B33; }

/* 阵营横幅 */
.camp-banner {
  position: absolute;
  left: 50%;
  top: 112px;
  z-index: 40;
  transform: translateX(-50%);
  padding: 10px 26px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 226, 150, .98), rgba(235, 151, 41, .98));
  border: 2px solid #FFF2C8;
  color: #3A1A02;
  font-size: 19px;
  font-weight: 900;
  letter-spacing: .04em;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .4), 0 0 22px rgba(255, 180, 60, .45);
  animation: campIn .35s cubic-bezier(.2, .8, .2, 1);
}
.camp-banner.catcher {
  background: linear-gradient(180deg, rgba(255, 140, 120, .98), rgba(190, 42, 30, .98));
  border-color: #FFD2C6;
  color: #FFF5ED;
}
@keyframes campIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-12px) scale(.96); }
  to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

/* 玩家信息 */
.me-row {
  position: absolute;
  left: 18px;
  top: 532px;
  z-index: 18;
  width: 360px;
  height: 62px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.me-chip {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 7px;
  border-radius: 15px;
  background: linear-gradient(180deg, rgba(45, 22, 10, .86), rgba(22, 9, 4, .82));
  border: 1px solid rgba(255, 218, 160, .35);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
  transition: border-color .2s, box-shadow .2s;
}
.me-chip.active {
  border-color: rgba(255, 190, 72, .92);
  box-shadow: 0 0 0 2px rgba(255, 190, 72, .20), 0 0 24px rgba(255, 160, 40, .38);
}
.me-chip .seat-avatar { width: 42px; height: 42px; }
.me-name { color: #FFF2DA; font-size: 14px; font-weight: 900; line-height: 1.1; }
.me-role { margin-top: 2px; color: #FFD36A; font-size: 10px; font-weight: 800; }
.hand-hint {
  min-width: 0;
  flex: 1;
  color: rgba(255, 236, 205, .78);
  font-size: 11px;
  line-height: 1.35;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hand-hint.good { color: #A8E7BF; }
.hand-hint.bad { color: #FFA58A; }

/* 浮动亮A/反A */
.float-btn {
  position: absolute;
  z-index: 25;
  height: 48px;
  padding: 0 20px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: .03em;
  border: 2px solid rgba(255, 255, 255, .45);
  box-shadow: 0 4px 0 rgba(0, 0, 0, .25), 0 6px 18px rgba(0, 0, 0, .3);
}
.float-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0, 0, 0, .25); }
.reveal {
  left: 300px;
  top: 366px;
  min-width: 154px;
  background: linear-gradient(180deg, #FFE08A, #FF9A24);
  color: #3A1600;
}
.reveal.status,
.reveal.status:disabled {
  min-width: 154px;
  background: rgba(34, 16, 7, .76);
  border-color: rgba(255, 219, 164, .30);
  color: #FFD89A;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .2);
  opacity: .94;
  filter: none;
  pointer-events: none;
}
.hide-start {
  left: 482px;
  top: 366px;
  background: linear-gradient(180deg, #9FE2B8, #2E8B57);
  color: #062A18;
}
.hide-start:not(.hidden) {
  animation: startPulse 1.9s ease-in-out infinite;
}
@keyframes startPulse {
  0%, 100% { box-shadow: 0 4px 0 rgba(0, 0, 0, .25), 0 6px 18px rgba(0, 0, 0, .3); }
  50% { box-shadow: 0 4px 0 rgba(0, 0, 0, .25), 0 0 0 7px rgba(255, 201, 71, .16), 0 0 28px rgba(255, 190, 60, .55); }
}
.counter {
  left: 640px;
  top: 366px;
  background: linear-gradient(180deg, #FF9A72, #C93420);
  color: #FFF6EE;
}

/* 手牌 */
.hand {
  position: absolute;
  left: 18px;
  right: 8px;
  bottom: 12px;
  z-index: 22;
  height: 98px;
}
.hand-card {
  position: absolute;
  bottom: 0;
  width: 64px;
  height: 94px;
  transition: transform .14s cubic-bezier(.2, .8, .2, 1), box-shadow .14s, filter .14s;
  will-change: transform;
}
.hand-card.sel {
  transform: translateY(-14px) scale(1.035);
  box-shadow: 0 0 0 2px #FFC947, 0 0 16px rgba(255, 190, 60, .7), 0 12px 20px rgba(0, 0, 0, .45);
}
.hand-card:active { transform: translateY(-6px); }
.hand-card.just-captured { animation: capturedGlow 1.4s ease; }
@keyframes capturedGlow {
  0%, 100% { filter: none; }
  30% { filter: drop-shadow(0 0 12px #FFC947) brightness(1.15); }
}

/* 出牌按钮 */
.actions {
  position: absolute;
  right: 18px;
  top: 428px;
  z-index: 24;
  width: 184px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.action-btn {
  width: 100%;
  height: 58px;
  border-radius: 18px;
  font-size: 21px;
  font-weight: 900;
  letter-spacing: .06em;
  border: 2px solid rgba(255, 255, 255, .42);
  box-shadow: 0 4px 0 rgba(0, 0, 0, .3), 0 8px 18px rgba(0, 0, 0, .28);
}
.action-btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, .3); }
.action-btn.play {
  background: linear-gradient(180deg, #FFE08A, #FF9A24);
  color: #3A1600;
}
.action-btn.pass {
  background: linear-gradient(180deg, #66C8F2, #197CBE);
  color: #FFF8EE;
}
.action-btn.hint {
  height: 38px;
  border-radius: 12px;
  background: rgba(34, 16, 7, .7);
  border: 1px solid rgba(255, 218, 160, .32);
  color: #FFD89A;
  font-size: 13px;
  font-weight: 800;
  box-shadow: none;
}
.action-btn:disabled {
  opacity: 1;
  filter: grayscale(.22) brightness(.66) saturate(.7);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
}

/* 开局面板：第一步必须一眼知道点哪里 */
.start-overlay {
  position: absolute;
  inset: 0;
  z-index: 125;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 26px;
  background:
    radial-gradient(ellipse at 50% 48%, rgba(20, 10, 4, .18) 0%, rgba(10, 5, 2, .62) 72%, rgba(8, 4, 2, .78) 100%);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.start-card {
  position: relative;
  width: 100%;
  max-width: 620px;
  max-height: 100%;
  overflow-y: auto;
  padding: 24px 26px 20px;
  border-radius: 26px;
  background: linear-gradient(180deg, #FFF9EE 0%, #F7E7CE 100%);
  border: 2px solid #FFD79A;
  box-shadow: 0 26px 70px rgba(0, 0, 0, .58), inset 0 1px 0 rgba(255, 255, 255, .9);
  color: #2A1B0E;
  text-align: center;
  animation: startIn .28s cubic-bezier(.2, .8, .2, 1);
  scrollbar-width: none;
}
.start-card::-webkit-scrollbar { display: none; }
.start-card.catcher {
  border-color: #B9D6C8;
  background: linear-gradient(180deg, #F5FBF7 0%, #E4F0E9 100%);
}
@keyframes startIn {
  from { opacity: 0; transform: translateY(14px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.start-kicker {
  color: #B96A2A;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .18em;
}
.start-title {
  margin: 5px 0 7px;
  font-size: 31px;
  font-weight: 900;
  letter-spacing: -.03em;
  line-height: 1.18;
  color: #3A1A02;
}
.start-card.catcher .start-title { color: #17402E; }
.start-desc {
  margin: 0 auto;
  max-width: 500px;
  color: #6B5844;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.7;
}
.start-card.catcher .start-desc { color: #4C6A5C; }
.start-facts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
}
.start-fact {
  padding: 5px 10px;
  border-radius: 999px;
  background: #FFF1D6;
  border: 1px solid #F0D8AF;
  color: #8A5A20;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.start-card.catcher .start-fact {
  background: #E8F4EC;
  border-color: #C6E0D3;
  color: #2E6A4F;
}
.start-actions {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 15px;
}
.start-btn {
  width: 100%;
  min-height: 56px;
  padding: 0 18px;
  border-radius: 16px;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: .04em;
  border: 2px solid rgba(255, 255, 255, .5);
  transition: transform .12s, box-shadow .12s, filter .12s;
}
.start-btn:active { transform: translateY(2px); filter: brightness(.97); }
.start-btn.primary {
  background: linear-gradient(180deg, #FFE08A, #FF9A24);
  border-color: #FFF2C8;
  color: #3A1600;
  box-shadow: 0 4px 0 #C45614, 0 8px 20px rgba(120, 55, 5, .28);
}
.start-btn.secondary {
  background: linear-gradient(180deg, #A6E7C0, #2E8B57);
  border-color: #DDF7E7;
  color: #062A18;
  box-shadow: 0 4px 0 #1D6039, 0 8px 20px rgba(10, 50, 30, .24);
}
.start-btn.counter {
  background: linear-gradient(180deg, #FFA383, #C93420);
  border-color: #FFD9CF;
  color: #FFF6EE;
  box-shadow: 0 4px 0 #8E1F10, 0 8px 20px rgba(90, 20, 10, .28);
}
.start-rules {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 12px;
  padding: 7px 12px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid #DCC3A2;
  color: #8A5A32;
  font-size: 12px;
  font-weight: 800;
}
.start-rules .mp-icon { width: 16px; height: 16px; color: #C9792B; }
.start-rules:active { background: #F3E1C8; }

/* 卡牌 */
.card {
  position: relative;
  flex: none;
  width: 64px;
  height: 94px;
  border-radius: 8px;
  background: linear-gradient(180deg, #FFFDF8, #F6EDE0);
  border: 1px solid rgba(120, 88, 55, .22);
  box-shadow: 0 2px 0 rgba(90, 60, 30, .18), 0 5px 10px rgba(20, 10, 4, .2);
  color: #2A1B0E;
  overflow: hidden;
  user-select: none;
}
.card.red { color: #D6473A; }
.card-corner {
  position: absolute;
  left: 4px;
  top: 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}
.card-corner b { font-size: 17px; font-weight: 900; letter-spacing: -.03em; }
.card-corner span { font-size: 12px; margin-top: 1px; }
.card-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 30px;
  opacity: .92;
}
.card-bottom {
  position: absolute;
  right: 4px;
  bottom: 3px;
  font-size: 15px;
  transform: rotate(180deg);
  opacity: .85;
}
.card.black { color: #241A12; }
.card.red { color: #D6473A; }
.big-a-tag {
  position: absolute;
  left: 50%;
  bottom: 4px;
  transform: translateX(-50%);
  padding: 1px 4px;
  border-radius: 4px;
  background: linear-gradient(180deg, #FFE18A, #FFB23E);
  color: #4A2400;
  font-size: 8px;
  font-weight: 900;
  white-space: nowrap;
}
.four-tag {
  position: absolute;
  right: 2px;
  top: 22px;
  width: 14px;
  height: 14px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #2E8B57;
  color: #FFF;
  font-size: 8px;
  font-weight: 900;
}
.card.joker-big .joker-label, .card.joker-small .joker-label {
  position: absolute;
  left: 5px;
  top: 5px;
  color: #C0392B;
  font-size: 12px;
  font-weight: 900;
  line-height: .9;
}
.card.joker-big .joker-star, .card.joker-small .joker-star {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #D9A21B;
  font-size: 28px;
}
.card.joker-big { background: linear-gradient(180deg, #FFF8E3, #FFE9B8); }
.card.joker-small { background: linear-gradient(180deg, #FFFDF8, #F0E8DA); }
.hand-card.big-a, .table-cards .card.big-a { border-color: #E8A62A; }
.hand-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 240, 215, .6);
  font-size: 13px;
}

/* Toast */
.toast {
  position: absolute;
  left: 50%;
  bottom: 124px;
  z-index: 120;
  transform: translate(-50%, 10px);
  max-width: 640px;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(20, 9, 4, .9);
  border: 1px solid rgba(255, 218, 160, .35);
  color: #FFE9C9;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s, transform .18s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { border-color: rgba(255, 120, 100, .6); color: #FFC4B4; }
.toast.good { border-color: rgba(120, 220, 160, .5); color: #C6F0D6; }

/* 弹层 */
.modal {
  position: absolute;
  inset: 0;
  z-index: 130;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(8, 4, 2, .7);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}
.modal-card {
  position: relative;
  width: 100%;
  max-width: 540px;
  max-height: 88%;
  overflow-y: auto;
  padding: 22px 24px;
  border-radius: 22px;
  background: linear-gradient(180deg, #FFF8EC, #F6E8D2);
  color: #2A1B0E;
  box-shadow: 0 22px 60px rgba(0, 0, 0, .5);
  animation: modalIn .24s cubic-bezier(.2, .8, .2, 1);
  scrollbar-width: none;
}
.modal-card::-webkit-scrollbar { display: none; }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-kicker {
  color: #B96A2A;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .14em;
}
.modal-title {
  margin: 3px 0 6px;
  font-size: 25px;
  font-weight: 900;
  letter-spacing: -.03em;
  line-height: 1.2;
}
.modal-sub {
  margin: 0 0 12px;
  color: #6B5844;
  font-size: 13px;
  line-height: 1.65;
}
.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 16px;
}
.modal-actions.row { flex-direction: row; }
.modal-actions .btn {
  flex: 1;
  height: 48px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 900;
  border: 1px solid transparent;
}
.modal-actions .btn-primary {
  background: linear-gradient(180deg, #FFB25F, #FF8A3D);
  border-color: rgba(255, 255, 255, .5);
  color: #2A1305;
  box-shadow: 0 4px 0 #C45614;
}
.modal-actions .btn-primary:active { transform: translateY(2px); box-shadow: none; }
.modal-actions .btn-soft {
  background: #F1E2CC;
  border-color: #E0CBAE;
  color: #5C452D;
}
.modal-actions .btn-ghost {
  background: transparent;
  border-color: #D8C3A5;
  color: #7A5B3A;
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #F1E2CC;
  color: #6B4A2A;
}
.modal-close .mp-icon { width: 19px; height: 19px; }

/* 身份卡 */
.identity-card { text-align: left; }
.identity-role {
  width: 64px;
  height: 64px;
  margin-bottom: 8px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(180deg, #FFE18A, #FFB23E);
  color: #4A2400;
  box-shadow: 0 6px 16px rgba(180, 100, 15, .28);
}
.identity-role.catcher {
  background: linear-gradient(180deg, #9DB8B0, #5B7F72);
  color: #F6FFF9;
}
.identity-role .mp-icon { width: 34px; height: 34px; }
.identity-title { margin: 0 0 4px; font-size: 26px; font-weight: 900; letter-spacing: -.03em; }
.identity-sub { margin: 0 0 10px; color: #6B5844; font-size: 13px; line-height: 1.65; }
.identity-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin: 10px 0;
}
.identity-facts .fact {
  padding: 8px 10px;
  border-radius: 10px;
  background: #FFFDF8;
  border: 1px solid #EADCC6;
  color: #5C4A38;
  font-size: 11.5px;
  line-height: 1.4;
}
.identity-facts .fact b { display: block; color: #3A2412; font-size: 10px; margin-bottom: 1px; }
.identity-note {
  margin: 8px 0 0;
  padding: 9px 11px;
  border-radius: 10px;
  background: #FFF4DD;
  border: 1px solid #F0DCB8;
  color: #7B5A32;
  font-size: 11.5px;
  line-height: 1.6;
}

/* 结果 */
.modal-card.result-card { text-align: center; max-height: 94%; }
.result-badge {
  width: 74px;
  height: 74px;
  margin: 0 auto 10px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 30%, #FFF3C4, #FFC947);
  border: 3px solid #FFF7DA;
  color: #6A3A06;
  box-shadow: 0 10px 26px rgba(255, 180, 60, .35);
}
.result-badge .mp-icon { width: 38px; height: 38px; }
.result-card.lose .result-badge {
  background: linear-gradient(180deg, #DDE8E1, #A9C4B4);
  border-color: #F1F7F3;
  color: #2E5A44;
}
.result-title { margin: 0; font-size: 30px; font-weight: 900; letter-spacing: -.03em; }
.result-sub { margin: 5px 0 0; color: #6B5844; font-size: 13px; line-height: 1.6; }
.result-reveal {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: #FFFDF8;
  border: 1px solid #EADCC6;
  color: #5C4A38;
  font-size: 12px;
  line-height: 1.7;
  text-align: left;
}
.result-reveal b { color: #3A2412; }
.master-row { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.master-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 6px;
  background: #FFF1C9;
  color: #8A5A05;
  font-size: 10.5px;
  font-weight: 800;
}
.rank-board { display: flex; flex-direction: column; gap: 5px; margin-top: 9px; }
.rank-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 9px;
  background: #FFFDF8;
  border: 1px solid #EADCC6;
  font-size: 11.5px;
}
.rank-row.first { background: #FFF7DB; border-color: #EFD79A; }
.rank-badge {
  flex: none;
  width: 42px;
  padding: 2px 0;
  border-radius: 6px;
  background: #F4E8D6;
  color: #8A5A05;
  font-size: 10px;
  font-weight: 900;
  text-align: center;
}
.rank-row.first .rank-badge { background: #FFC947; color: #3A2200; }
.rank-name { flex: 1; min-width: 0; color: #3A2717; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-cards { flex: none; color: #9A8268; font-size: 10px; }
.mult-chip-result {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #FFF0DD;
  border: 1px solid #F0D3B0;
  color: #A05B1E;
  font-size: 11px;
  font-weight: 900;
}
.result-note { margin: 8px 0 0; color: #86705A; font-size: 10.5px; line-height: 1.55; text-align: left; }
.confetti {
  position: absolute;
  top: -8px;
  width: 7px;
  height: 12px;
  border-radius: 2px;
  animation: confettiFall linear forwards;
  pointer-events: none;
}
@keyframes confettiFall {
  0% { transform: translateY(-10px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(460px) rotate(540deg); opacity: 0; }
}

/* 规则 */
.rules-body h3 {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 12px 0 3px;
  color: #3A2412;
  font-size: 13.5px;
}
.rules-body h3 .mp-icon { width: 16px; height: 16px; color: #D97A2A; }
.rules-body p { margin: 0 0 7px; color: #5C4A38; font-size: 12px; line-height: 1.7; }
.rules-body strong { color: #3A2412; }
.type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.type-chip {
  padding: 6px 8px;
  border-radius: 8px;
  background: #FFFDF8;
  border: 1px solid #EADCC6;
  color: #6B5844;
  font-size: 10.5px;
  line-height: 1.4;
}
.type-chip b { display: block; margin-bottom: 1px; color: #3A2412; font-size: 11px; }
.rank-line { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; margin: 5px 0; color: #5C4A38; font-size: 10.5px; line-height: 1.5; }
.rank-line span { padding: 2px 5px; border-radius: 5px; background: #F6E8D2; font-weight: 700; }
.rank-line .arrow { padding: 0; background: none; color: #B99A78; }
.rules-tip {
  margin-top: 10px;
  padding: 9px 11px;
  border-radius: 10px;
  background: #FFF4DD;
  border: 1px solid #F0DCB8;
  color: #7B5A32;
  font-size: 11px;
  line-height: 1.6;
}

/* 菜单 */
.menu-list { display: flex; flex-direction: column; gap: 7px; margin-top: 10px; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px;
  border-radius: 12px;
  background: #FFFDF8;
  border: 1px solid #EADCC6;
  color: #4A3420;
  font-size: 14px;
  font-weight: 800;
  text-align: left;
}
.menu-item .mp-icon { width: 19px; height: 19px; color: #D97A2A; }
.menu-item.danger { color: #A33224; }
.menu-item.danger .mp-icon { color: #C23B2B; }
.diff-row { display: flex; gap: 6px; margin: 8px 0 4px; }
.diff-row .diff {
  flex: 1;
  height: 38px;
  border-radius: 10px;
  background: #FFFDF8;
  border: 1px solid #EADCC6;
  color: #8A6E52;
  font-size: 12px;
  font-weight: 900;
}
.diff-row .diff.on {
  background: linear-gradient(180deg, #FFB25F, #FF8A3D);
  border-color: #FF8A3D;
  color: #2A1305;
  box-shadow: 0 2px 0 #C45614;
}

/* 竖屏牌桌：720×1560 参考画布，等比缩放铺满手机竖屏。
   牌桌、座位、按钮重排，不再出现“请横屏”挡板。 */
@media (orientation: portrait) {
  :root {
    --stage-w: 720px;
    --stage-h: 1560px;
  }
  #app { background: radial-gradient(circle at 50% 25%, #2A160C, #070403 72%); }
  #stage { border-radius: 0; box-shadow: none; }
  #scene { object-position: 50% 50%; }
  .scene-vignette {
    background:
      linear-gradient(180deg, rgba(20, 8, 3, .62) 0%, rgba(20, 8, 3, .14) 12%, rgba(20, 8, 3, 0) 26%, rgba(20, 8, 3, 0) 44%, rgba(16, 7, 3, .30) 56%, rgba(14, 7, 3, .80) 63%, #1a0e07 67%, #120a05 100%),
      radial-gradient(ellipse at 50% 34%, transparent 34%, rgba(10, 5, 2, .44) 100%);
  }

  .hud { left: 14px; right: 14px; top: 16px; gap: 6px; }
  .hud-btn { width: 44px; height: 44px; border-radius: 12px; }
  .hud-btn .mp-icon { width: 22px; height: 22px; }
  .hud-chip { height: 34px; padding: 0 9px; font-size: 12px; border-radius: 10px; }
  .hud-chip .mp-icon { width: 15px; height: 15px; }
  .count-chip { min-width: 46px; }
  .mult-chip { min-width: 70px; }
  .clock-chip { min-width: 70px; }
  .hud-right { gap: 6px; }

  .camp-banner {
    top: 70px;
    max-width: 690px;
    padding: 8px 16px;
    font-size: 14px;
    line-height: 1.35;
    text-align: center;
    white-space: normal;
  }

  /* 四名 AI 在牌桌上方排成一行，露出后方主视觉人物 */
  .seat {
    width: 168px;
    height: 54px;
    padding: 5px 7px;
    gap: 6px;
    border-radius: 13px;
  }
  .seat-left-top { left: 12px; top: 498px; }
  .seat-left-mid { left: 186px; top: 498px; }
  .seat-right-top { left: 360px; right: auto; top: 498px; }
  .seat-right-mid { left: 534px; right: auto; top: 498px; }
  .seat-avatar, .avatar-wrap, .avatar-wrap .seat-avatar { width: 38px; height: 38px; }
  .seat-name { font-size: 12px; }
  .seat-meta { margin-top: 2px; font-size: 9px; }
  .seat-meta .mp-icon { width: 10px; height: 10px; }
  .seat-turn-tag { display: none; }

  .table-wrap { top: 596px; width: 660px; min-height: 300px; }
  .table-felt {
    top: 6px;
    width: 600px;
    height: 448px;
    border-radius: 160px / 150px;
    background: radial-gradient(ellipse at 50% 45%, rgba(22, 60, 43, .985) 0%, rgba(18, 50, 36, .975) 60%, rgba(14, 40, 29, .94) 100%);
  }
  .table-cards { min-height: 120px; padding: 0 18px; }
  .table-cards .card { margin-left: -17px; }
  .table-status { margin-top: 6px; max-width: 610px; padding: 4px 12px; font-size: 11px; }
  .clock-orb { display: none; }

  .me-row { left: 14px; top: 930px; width: 692px; height: 58px; }
  .me-chip { height: 54px; border-radius: 14px; }
  .me-chip .seat-avatar, .me-chip .avatar-wrap, .me-chip .avatar-wrap .seat-avatar { width: 40px; height: 40px; }
  .me-name { font-size: 13px; }
  .me-role { font-size: 9.5px; }
  .hand-hint { font-size: 11px; }

  .float-btn { height: 50px; padding: 0 18px; font-size: 14px; }
  .reveal { left: 22px; top: 1000px; min-width: 150px; }
  .hide-start { left: 186px; top: 1000px; }
  .counter { left: 356px; top: 1000px; }

  .actions { right: 14px; top: 1080px; width: 170px; gap: 9px; }
  .action-btn { height: 54px; border-radius: 16px; font-size: 19px; }
  .action-btn.hint { height: 36px; font-size: 12px; }

  .hand { left: 14px; right: 14px; bottom: 10px; height: 204px; }
  .hand-card { width: 64px; height: 94px; }

  .toast {
    bottom: 240px;
    max-width: 620px;
    padding: 9px 15px;
    font-size: 12px;
    white-space: normal;
  }
  .modal { padding: 14px; }
  .modal-card { max-width: 660px; max-height: 88%; padding: 20px 22px; border-radius: 20px; }
  .modal-title { font-size: 23px; }
  .modal-sub { font-size: 12.5px; }
  .result-title { font-size: 28px; }
  .rules-body p { font-size: 11.5px; }
  .type-chip { font-size: 10px; }
  .modal-actions .btn { height: 46px; }
}

@media (max-height: 430px) and (orientation: landscape) {
  .hud { top: 8px; }
  .hud-btn { width: 42px; height: 42px; }
  .hud-chip { height: 36px; font-size: 12px; }
}

.float-btn:disabled {
  opacity: 1;
  filter: grayscale(.25) brightness(.72) saturate(.7);
  box-shadow: none;
}

.me-count {
  margin-left: 4px;
  color: #FFD89A;
  font-size: 10px;
  font-weight: 800;
}

.avatar-wrap {
  position: relative;
  flex: none;
  width: 46px;
  height: 46px;
}
.avatar-wrap .seat-avatar {
  width: 46px;
  height: 46px;
}
.me-chip .avatar-wrap {
  width: 42px;
  height: 42px;
}
.me-chip .avatar-wrap .seat-avatar {
  width: 42px;
  height: 42px;
}

.table-felt {
  position: absolute;
  left: 50%;
  top: -72px;
  z-index: 0;
  width: 620px;
  height: 232px;
  transform: translateX(-50%);
  border-radius: 120px / 70px;
  background-color: #143c2b;
  background-image:
    radial-gradient(ellipse at 50% 42%, #1d523b 0%, #174631 58%, #103525 100%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .022) 0 2px, transparent 2px 5px);
  border: 2px solid rgba(255, 205, 130, .22);
  box-shadow: inset 0 0 60px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 220, 160, .12), 0 12px 30px rgba(0, 0, 0, .3);
  pointer-events: none;
}
.table-felt::after {
  content: '大A';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 225, 160, .075);
  font-size: 96px;
  font-weight: 900;
  letter-spacing: .10em;
  text-shadow: 0 0 32px rgba(255, 190, 90, .12);
  pointer-events: none;
}
.table-cards, .table-status {
  position: relative;
  z-index: 2;
}

/* 手牌按绝对坐标叠放：.card 的 position:relative 会覆盖 .hand-card 的定位，
   这里用更高优先级锁定，否则 22 张手牌会竖着排到屏幕外。 */
#hand .hand-card {
  position: absolute;
}
#hand .hand-card:active {
  transform: translateY(-6px);
}
