* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  overflow: hidden;
  background: #123B2A;
  color: #FFF6E8;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  user-select: none;
}

.stage {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  overflow: hidden;
}

.felt {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 90% at 50% 8%, #2E7A55 0%, #1C5B3E 45%, #123B2A 100%);
  overflow: hidden;
}
.felt-glow {
  position: absolute; left: 50%; top: 46%;
  width: 78vmax; height: 78vmax;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.10) 0%, rgba(255,255,255,.03) 45%, rgba(255,255,255,0) 70%);
  pointer-events: none;
}
.felt::after {
  content: "";
  position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(45deg, rgba(255,255,255,.035) 0 2px, rgba(0,0,0,0) 2px 6px);
  pointer-events: none;
}

/* ---------- 座位 ---------- */
.seat {
  position: absolute;
  display: flex; align-items: center; gap: 8px;
  z-index: 5;
}
.seat-left { left: 14px; top: 12px; }
.seat-right { right: 14px; top: 12px; flex-direction: row-reverse; }
.seat-me { left: 14px; bottom: 12px; }

.avatar {
  position: relative;
  width: 46px; height: 46px; flex: 0 0 46px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #FFB877, #FF8A3D);
  border: 2px solid rgba(255,255,255,.55);
  box-shadow: 0 4px 10px rgba(0,0,0,.35);
  color: #fff;
  font-size: 24px;
}
.avatar .mp-icon { font-size: 24px; }
.avatar-lord { background: linear-gradient(160deg, #FFD36E, #FF8A3D); }
.avatar-farmer { background: linear-gradient(160deg, #8FD3FF, #3E8FD6); }
.avatar-me { background: linear-gradient(160deg, #FFC48A, #FF7A2F); }
.crown {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  color: #FFE07A; font-size: 16px;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,.5));
}
.crown .mp-icon { font-size: 16px; }

.seat-info { display: flex; flex-direction: column; gap: 2px; }
.seat-right .seat-info { align-items: flex-end; }
.seat-name {
  font-size: 12px; font-weight: 700; letter-spacing: .04em;
  color: #FFF3DC; text-shadow: 0 1px 2px rgba(0,0,0,.5);
}
.seat-cards {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; color: #CFE9D8;
  background: rgba(0,0,0,.28);
  padding: 2px 7px; border-radius: 999px;
}
.seat-cards .mp-icon { font-size: 12px; }
.seat-cards b { color: #FFD98A; font-size: 12px; }

.bubble {
  position: absolute; top: 52px; left: 0;
  min-width: 44px; padding: 4px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,.94);
  color: #1C3B2C; font-size: 12px; font-weight: 700;
  white-space: nowrap;
  opacity: 0; transform: translateY(-4px) scale(.9);
  transition: opacity .18s, transform .18s;
  box-shadow: 0 4px 10px rgba(0,0,0,.3);
}
.seat-right .bubble { left: auto; right: 0; }
.bubble.show { opacity: 1; transform: translateY(0) scale(1); }

/* ---------- 中央出牌区 ---------- */
.table-center {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: min(72%, 620px);
  height: 46%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 4px;
  pointer-events: none;
}
.play-row {
  display: flex; align-items: center; justify-content: center;
  min-height: 0;
  gap: 0;
}
.play-row .mini-card { margin-left: -14px; }
.play-row .mini-card:first-child { margin-left: 0; }
.center-tip {
  font-size: 13px; color: rgba(255,255,255,.72);
  letter-spacing: .06em;
  text-shadow: 0 1px 3px rgba(0,0,0,.5);
  transition: opacity .2s;
}

/* ---------- 底牌 ---------- */
.bottom-cards {
  position: absolute; left: 50%; top: 10px;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px;
  z-index: 4;
}
.bottom-label {
  font-size: 11px; color: rgba(255,255,255,.6);
  letter-spacing: .1em;
}
.bottom-list { display: flex; gap: 3px; }

/* ---------- 手牌 ---------- */
.hand {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 34%;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0 12px 8px;
  z-index: 6;
}

.card {
  position: relative;
  width: 46px; height: 66px;
  flex: 0 0 auto;
  border-radius: 8px;
  background: linear-gradient(170deg, #FFFFFF 0%, #F6F1E6 100%);
  border: 1px solid rgba(0,0,0,.14);
  box-shadow: 0 3px 8px rgba(0,0,0,.32);
  color: #22262B;
  display: flex; flex-direction: column;
  align-items: flex-start; justify-content: flex-start;
  padding: 4px 5px;
  transition: transform .16s cubic-bezier(.2,.9,.3,1.2), box-shadow .16s;
  cursor: pointer;
  overflow: hidden;
}
.card .rank {
  font-size: 17px; font-weight: 800; line-height: 1;
  letter-spacing: -.02em;
}
.card .suit {
  font-size: 15px; line-height: 1; margin-top: 2px;
}
.card .big-suit {
  position: absolute; right: 4px; bottom: 2px;
  font-size: 22px; opacity: .28; line-height: 1;
}
.card.red { color: #D93A3A; }
.card.black { color: #22262B; }
.card.joker .rank { font-size: 12px; letter-spacing: 0; }
.card.joker .big-suit { font-size: 20px; opacity: .35; }

.hand .card { margin-left: -18px; }
.hand .card:first-child { margin-left: 0; }
.hand .card.selected {
  transform: translateY(-16px);
  box-shadow: 0 10px 18px rgba(0,0,0,.4), 0 0 0 2px #FF8A3D;
  z-index: 3;
}
.hand .card:active { transform: translateY(-8px); }

.mini-card {
  width: 30px; height: 42px;
  border-radius: 5px;
  background: linear-gradient(170deg, #FFFFFF, #F1EBDD);
  border: 1px solid rgba(0,0,0,.14);
  box-shadow: 0 2px 5px rgba(0,0,0,.28);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800;
  color: #22262B;
}
.mini-card.red { color: #D93A3A; }
.mini-card.back {
  background: repeating-linear-gradient(45deg, #C8452F 0 4px, #A93422 4px 8px);
  border-color: rgba(255,255,255,.35);
  color: transparent;
}

/* ---------- 操作条 ---------- */
.actions {
  position: absolute; right: 14px; bottom: 12px;
  display: flex; gap: 8px;
  z-index: 8;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.actions.show { opacity: 1; pointer-events: auto; }

.btn {
  appearance: none; border: 0;
  font-family: inherit; font-size: 14px; font-weight: 700;
  padding: 10px 18px; border-radius: 999px;
  cursor: pointer;
  transition: transform .12s, filter .12s;
  display: inline-flex; align-items: center; gap: 4px;
}
.btn:active { transform: scale(.94); filter: brightness(.94); }
.btn-main {
  color: #fff;
  background: linear-gradient(170deg, #FFA45C, #FF8A3D 55%, #F06E1E);
  box-shadow: 0 6px 14px rgba(240,110,30,.45), inset 0 1px 0 rgba(255,255,255,.5);
}
.btn-ghost {
  color: #FFF3DC;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.28);
  backdrop-filter: blur(4px);
}
.btn:disabled { opacity: .45; cursor: default; }
.btn .mp-icon { font-size: 16px; }

/* ---------- 遮罩 ---------- */
.overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 45%, rgba(6,26,18,.55), rgba(4,18,12,.86));
  backdrop-filter: blur(3px);
  z-index: 20;
  transition: opacity .25s;
}
.overlay.hide { opacity: 0; pointer-events: none; }

.overlay-card {
  width: min(78%, 420px);
  padding: 22px 24px 20px;
  border-radius: 22px;
  text-align: center;
  background: linear-gradient(175deg, #FFFDF7, #F3EADA);
  color: #2A2118;
  border: 1px solid rgba(255,255,255,.7);
  box-shadow: 0 18px 40px rgba(0,0,0,.45), inset 0 1px 0 #fff;
}
.overlay-title {
  font-size: 26px; font-weight: 800; letter-spacing: .04em;
  color: #E86A1C;
  text-shadow: 0 2px 0 rgba(255,255,255,.9);
}
.overlay-desc {
  margin-top: 8px; font-size: 13px; color: #7A6A57; line-height: 1.5;
}
.overlay-score {
  margin-top: 10px; font-size: 13px; font-weight: 700; color: #2E7A55;
  min-height: 0;
}
.btn-start {
  margin-top: 16px; padding: 12px 34px; font-size: 16px;
}

/* ---------- toast ---------- */
.toast {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%) scale(.9);
  padding: 10px 20px; border-radius: 999px;
  background: rgba(0,0,0,.72);
  color: #fff; font-size: 14px; font-weight: 700;
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 30;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* ---------- 横屏适配 ---------- */
@media (orientation: portrait) {
  .hand { height: 30%; }
  .card { width: 40px; height: 58px; }
  .hand .card { margin-left: -20px; }
  .table-center { height: 40%; }
}
@media (max-height: 380px) {
  .card { width: 40px; height: 58px; }
  .avatar { width: 38px; height: 38px; flex-basis: 38px; }
  .avatar .mp-icon { font-size: 20px; }
  .overlay-title { font-size: 22px; }
}
