/* 斗地主娱乐小游戏样式（与21点同一套视觉语言） */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --felt: #1c6b46;
  --felt-dark: #145034;
  --panel: #ffffff;
  --panel-border: #d9e2dc;
  --ink: #1c2b24;
  --accent: #0f8a5f;
  --accent-dark: #0b6b49;
  --warn: #c0392b;
  --gold: #d4a017;
  --red: #d63031;
  --gray: #7a8a80;
  --landlord: #b8860b;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: linear-gradient(160deg, #10281d 0%, #173a2a 55%, #10281d 100%);
  color: var(--ink);
  min-height: 100vh;
}

.app { max-width: 980px; margin: 0 auto; padding: 16px; }
.screen { display: none; }
.screen.active { display: block; }
.hidden { display: none !important; }

/* ---------- 通用 ---------- */
.btn {
  background: var(--accent); color: #fff; border: none;
  padding: 10px 22px; border-radius: 10px; font-size: 15px;
  cursor: pointer; transition: .15s; font-weight: 600;
}
.btn:hover { background: var(--accent-dark); transform: translateY(-1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.big { font-size: 19px; padding: 16px 34px; }
.btn.alt { background: #2563a8; }
.btn.alt:hover { background: #1d4f85; }
.btn.warn { background: var(--gold); color: #3a2c00; }
.btn.warn:hover { background: #b58910; }
.btn.ghost { background: transparent; color: #cfe3d7; border: 1px solid #3d5c4c; }
.btn.ghost:hover { background: rgba(255,255,255,.08); }
.btn.small { padding: 6px 12px; font-size: 13px; }

input {
  padding: 10px 12px; border: 1px solid #b9ccc1; border-radius: 8px;
  font-size: 15px; outline: none; background: #fbfdfc; color: var(--ink);
}
input:focus { border-color: var(--accent); }

.card-panel {
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 14px; padding: 18px; box-shadow: 0 4px 14px rgba(0,0,0,.25);
}

.tag {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  background: #e4efe9; color: var(--accent-dark); font-size: 13px; font-weight: 600;
}
.tag.gold { background: #fdf3d5; color: #8a6400; }

/* ---------- 首页 ---------- */
.home-wrap { text-align: center; padding: 48px 12px; color: #eaf5ee; }
.logo { font-size: 56px; letter-spacing: 4px; color: #fff; text-shadow: 0 3px 12px rgba(0,0,0,.5); }
.logo span { color: var(--gold); }
.slogan { margin: 12px 0 34px; color: #a9c9b6; letter-spacing: 2px; }
.home-btns { display: flex; gap: 18px; justify-content: center; margin-bottom: 40px; flex-wrap: wrap; }

.rules { max-width: 620px; margin: 0 auto; text-align: left; }
.rules h3 { margin-bottom: 10px; color: var(--accent-dark); }
.rules li { margin: 6px 0 6px 20px; color: #33463c; font-size: 14px; line-height: 1.6; }

/* ---------- 大厅 ---------- */
.lobby-wrap { max-width: 560px; margin: 30px auto; }
.lobby-wrap h2 { color: #fff; margin-bottom: 16px; text-align: center; }
.form-panel label { display: block; font-size: 13px; color: var(--gray); margin: 14px 0 6px; }
.form-panel input { width: 100%; }
.form-panel .btn { width: 100%; margin-top: 18px; }
.divider { text-align: center; color: #a7b8ae; font-size: 13px; margin: 20px 0 6px; }
.join-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.join-row .code-input { width: 110px; text-transform: uppercase; letter-spacing: 4px; text-align: center; font-weight: 700; }
.rejoin-tip { margin-top: 12px; font-size: 12px; color: var(--gray); line-height: 1.6; }
.rejoin-tip b { color: var(--accent-dark); }

/* ---------- 房间 ---------- */
.room-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 14px; color: #eaf5ee;
}
.room-code { font-size: 15px; }
.room-code b { font-size: 22px; letter-spacing: 5px; color: var(--gold); margin: 0 4px; }
#btn-copy { background: none; border: none; color: #a9c9b6; cursor: pointer; font-size: 15px; }

#need-more {
  background: #fff3cd; color: #7a5b00; text-align: center; font-weight: 700;
  padding: 10px; border-radius: 10px; margin-bottom: 14px; border: 1px solid #f1dc9b;
}

.table {
  background:
    radial-gradient(ellipse at center, var(--felt) 0%, var(--felt-dark) 100%);
  border-radius: 20px; padding: 22px 18px;
  border: 6px solid #6b4a1f; box-shadow: inset 0 0 60px rgba(0,0,0,.45), 0 8px 24px rgba(0,0,0,.4);
  margin-bottom: 14px;
  display: flex; flex-direction: column; gap: 10px;
}

/* ---------- 对手座位 ---------- */
.opp-row { display: flex; justify-content: space-between; gap: 12px; }
.opp-seat {
  background: rgba(0,0,0,.28); border-radius: 14px; padding: 12px;
  min-width: 170px; flex: 0 1 46%; text-align: center;
  border: 2px solid transparent; transition: .2s;
}
.opp-seat.is-turn { border-color: var(--gold); box-shadow: 0 0 14px rgba(212,160,23,.55); }
.pname { color: #fff; font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.role-badge {
  display: inline-block; padding: 1px 9px; border-radius: 12px;
  font-size: 12px; font-weight: 700; background: rgba(255,255,255,.15); color: #cfe3d7;
}
.role-badge.landlord { background: var(--landlord); color: #fff; }
.role-badge.peasant { background: #2563a8; color: #fff; }
.score-line { color: #ffd97a; font-size: 12px; font-weight: 700; margin-top: 5px; }
.bid-line { color: #b7d6c4; font-size: 12px; margin-top: 2px; min-height: 16px; }

.card-backs { display: flex; justify-content: center; gap: 2px; min-height: 34px; margin-top: 6px; flex-wrap: wrap; max-width: 100%; }
.card-back {
  width: 20px; height: 30px; border-radius: 3px;
  background: repeating-linear-gradient(45deg, #264d8f 0 4px, #1d3d73 4px 8px);
  border: 1px solid #16305c; box-shadow: 0 1px 3px rgba(0,0,0,.4);
}
.opp-played {
  margin-top: 6px; font-size: 12px; color: #ffe9b0; min-height: 16px; font-weight: 700;
}

/* ---------- 中央区 ---------- */
.center-area {
  text-align: center; min-height: 120px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
}
.bottom-cards { display: flex; gap: 6px; justify-content: center; }
.bottom-label { font-size: 12px; color: #a9c9b6; }

/* 迷你牌卡：底牌与出牌区共用（.bc 必须是独立类，不能只挂在 .bottom-cards 下） */
.bc {
  width: 34px; height: 48px; background: #fff; border-radius: 5px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; line-height: 1.1;
  box-shadow: 0 2px 6px rgba(0,0,0,.4); border: 1px solid #e5e5e5;
  flex: 0 0 auto;
}
.bc .bc-rank { font-size: 14px; }
.bc .bc-rank.bc-joker { font-size: 10px; }
.bc .bc-suit { font-size: 12px; }
.bc.red { color: var(--red); }
.bc.black { color: #222; }
.last-play .bc { width: 32px; height: 45px; }
.last-play .bc .bc-rank { font-size: 13px; }
.last-play .bc .bc-suit { font-size: 11px; }

.last-play { display: flex; gap: 5px; justify-content: center; flex-wrap: wrap; }
.last-play .lp-name { width: 100%; font-size: 12px; color: #ffe9b0; font-weight: 700; }
.last-play .pass-text { color: #b7d6c4; font-size: 14px; }

/* ---------- 我的座位 ---------- */
.my-seat {
  background: rgba(0,0,0,.28); border-radius: 14px; padding: 12px 14px;
  border: 2px solid transparent; transition: .2s;
}
.my-seat.is-turn { border-color: var(--gold); box-shadow: 0 0 14px rgba(212,160,23,.55); }
.my-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.my-head .pname { font-size: 15px; }
.my-tip { color: #ffe9b0; font-size: 14px; font-weight: 600; min-height: 20px; margin: 8px 0 6px; }
.my-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.act-group { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- 手牌 ---------- */
.my-hand {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end;
  min-height: 96px; max-width: 100%;
  margin: 10px 0 4px; row-gap: 12px; padding: 14px 8px 12px;
}
.mcard {
  width: 56px; height: 80px; background: #fff; border-radius: 8px;
  box-shadow: 0 3px 8px rgba(0,0,0,.45);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 19px; font-weight: 800; position: relative;
  border: 2px solid #e8e8e8; flex: 0 0 auto; cursor: pointer;
  transition: transform .12s, margin .12s;
  margin-left: -14px;
}
.my-hand .mcard:first-child { margin-left: 0; }
.my-hand .mcard:hover { transform: translateY(-6px); z-index: 2; }
.mcard.selected { transform: translateY(-14px); border-color: var(--gold); box-shadow: 0 6px 14px rgba(212,160,23,.5); }
.mcard.hinted { border-color: #2563a8; box-shadow: 0 0 0 2px #2563a8, 0 4px 12px rgba(37,99,168,.5); }
.mcard.red { color: var(--red); }
.mcard.black { color: #222; }
.mcard .suit { font-size: 21px; }
.mcard.joker .rank { font-size: 13px; line-height: 1.3; }
.mcard.joker .suit { font-size: 22px; }

/* ---------- 日志 ---------- */
.log-panel h4 { color: var(--accent-dark); margin-bottom: 8px; }
#log-list {
  max-height: 170px; overflow-y: auto; font-size: 13px; line-height: 1.8; color: #41564a;
}
#log-list div { border-bottom: 1px dashed #e4ece7; padding: 2px 0; }

/* ---------- 结算横幅 ---------- */
#round-banner {
  background: linear-gradient(90deg, #d4a017, #f0c94a);
  color: #3a2c00; text-align: center; font-size: 18px; font-weight: 800;
  padding: 12px; border-radius: 12px; margin-bottom: 14px;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%) translateY(20px);
  background: #23342b; color: #fff; padding: 10px 22px; border-radius: 10px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; z-index: 99;
  box-shadow: 0 6px 18px rgba(0,0,0,.4); max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 门户链接 ---------- */
.portal-link { margin: -22px 0 30px; }
.portal-link a { color: #a9c9b6; font-size: 14px; text-decoration: none; border-bottom: 1px dashed #3d5c4c; padding-bottom: 2px; }
.portal-link a:hover { color: #fff; }
.room-hall-link { color: #a9c9b6; font-size: 13px; text-decoration: none; border: 1px solid #3d5c4c; border-radius: 20px; padding: 4px 12px; transition: .15s; }
.room-hall-link:hover { color: #fff; background: rgba(255,255,255,.08); }

@media (max-width: 620px) {
  .logo { font-size: 40px; }
  .home-btns { flex-direction: column; align-items: center; }
  .mcard { width: 44px; height: 64px; font-size: 15px; }
  .mcard .suit { font-size: 16px; }
  .opp-seat { min-width: 130px; }
  .app { padding: 10px; }
  .table { padding: 14px 10px; }
}

/* ---------- 账号系统 ---------- */
.acct-box { border: 1px dashed #b9ccc1; border-radius: 10px; padding: 12px; margin-bottom: 16px; background: #f6faf7; }
.acct-row { display: flex; gap: 8px; }
.acct-row input { flex: 1; min-width: 0; }
.acct-btns { display: flex; gap: 8px; margin-top: 10px; }
.acct-btns .btn { flex: 1; }
.acct-hint { margin-top: 8px; font-size: 12px; color: var(--gray); }
#acct-profile { display: flex; align-items: center; gap: 12px; }
.acct-avatar { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; background: #dfe9e2; cursor: pointer; border: 2px solid var(--accent); }
.acct-info { flex: 1; display: flex; flex-direction: column; gap: 2px; font-size: 14px; min-width: 0; }
.acct-records, .acct-bank { color: var(--gray); font-size: 12px; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal-card { background: #fff; border-radius: 14px; padding: 18px; max-width: 320px; width: 100%; }
.modal-card h3 { margin-bottom: 10px; color: var(--accent-dark); }
.modal-card p { font-size: 14px; line-height: 1.6; color: #33463c; }
.crop-wrap { display: flex; justify-content: center; margin: 10px 0; }
#crop-canvas { border-radius: 8px; touch-action: none; cursor: grab; max-width: 100%; }
.zoom-row { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--gray); }
.zoom-row input { flex: 1; }
.crop-hint { font-size: 12px; color: var(--gray); margin: 6px 0 10px; }
.modal-btns { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
#avatar-file { font-size: 12px; }
.seat-avatar { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; vertical-align: -6px; margin-right: 5px; border: 1px solid rgba(255,255,255,.4); }
.rec-line { color: #9db8a8; font-size: 11px; min-height: 14px; margin-top: 2px; }

/* 底牌：背面与已打点数置灰 */
.bc.face-down { background: repeating-linear-gradient(45deg, #264d8f 0 5px, #1d3d73 5px 10px); border-color: #16305c; }
.bc.grayed { opacity: .35; filter: grayscale(1); }

/* ---------- 账号面板布局修正（覆盖 form-panel 按钮全宽规则） ---------- */
.acct-box .btn { width: auto; margin-top: 0; }
.acct-box .btn.ghost { color: var(--gray); border-color: #b9ccc1; }
.acct-box .btn.ghost:hover { background: #eef4ef; color: var(--ink); }
.acct-actions { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.acct-actions .acct-link { text-decoration: none; text-align: center; }

/* ---------- 社交系统：常用语气泡 ---------- */
.opp-seat, .my-seat { position: relative; }
.chat-bubble {
  position: absolute; bottom: calc(100% + 12px); left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: #fff; color: var(--ink); padding: 8px 14px; border-radius: 12px;
  font-size: 13px; font-weight: 700; line-height: 1.5;
  width: max-content; max-width: 230px; text-align: center;
  box-shadow: 0 4px 14px rgba(0,0,0,.35);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 30;
}
.chat-bubble::after {
  content: ''; position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: #fff; border-bottom: none;
}
.chat-bubble.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 社交系统：道具弹道动画 ---------- */
.prop-flyer {
  position: fixed; left: 0; top: 0; z-index: 120; pointer-events: none;
  font-size: 34px; line-height: 1; will-change: transform;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,.4));
}
.prop-impact {
  position: fixed; z-index: 121; pointer-events: none;
  font-size: 46px; line-height: 1; transform: translate(-50%, -50%);
}
@keyframes seat-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px) rotate(-1deg); }
  40% { transform: translateX(6px) rotate(1deg); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(4px); }
}
.seat-shake { animation: seat-shake .45s; }

/* ---------- 社交系统：常用语 / 道具弹窗 ---------- */
.social-btns { display: flex; gap: 8px; margin-left: auto; }
.social-btns .btn { padding: 4px 10px; font-size: 12px; }
.chat-list { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 4px; }
.chat-item {
  text-align: left; background: #f2f8f4; border: 1px solid #d9e2dc; border-radius: 10px;
  padding: 9px 12px; font-size: 14px; cursor: pointer; transition: .15s; color: var(--ink);
}
.chat-item:hover { background: #e3f1e8; border-color: var(--accent); }
.prop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0 4px; }
.prop-card {
  border: 1px solid #d9e2dc; border-radius: 12px; padding: 10px;
  text-align: center; background: #f6faf7; transition: .15s;
}
.prop-card.picked { border-color: var(--gold); background: #fdf6e3; box-shadow: 0 0 0 2px var(--gold); }
.prop-emoji { font-size: 34px; line-height: 1.2; }
.prop-name { font-size: 13px; font-weight: 700; color: #33463c; margin: 4px 0 8px; }
.prop-act-row { display: flex; gap: 6px; justify-content: center; }
.prop-act-row .btn { padding: 4px 10px; font-size: 12px; }
.target-row { margin-top: 10px; }
.target-row label { font-size: 13px; color: var(--gray); }
#target-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.target-btn.picked { border-color: var(--gold); color: #8a6400; background: #fdf6e3; }
.prop-hint { font-size: 12px; color: var(--gray); margin: 10px 0 2px; min-height: 16px; }
