/* GTO 德州扑克 — 样式 */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --felt1: #1d5c3a; --felt2: #0f3a24;
  --bg: #0b120e; --panel: #121c16; --line: #22352a;
  --gold: #d8b45a; --text: #e8e6df; --muted: #8ba394;
  --red: #d24b4b; --green: #4caf7d; --blue: #5a8fd8;
}
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: "LXGW WenKai Screen", "Yu Gothic UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  display: flex; flex-direction: column; overflow: hidden;
}

/* ---------- 顶栏 ---------- */
#topbar {
  position: relative; z-index: 60;   /* P1-C：高于结算遮罩 */
  display: flex; align-items: center; gap: 18px;
  padding: 10px 18px; border-bottom: 1px solid var(--line);
  background: var(--panel);
}
#topbar .brand { font-size: 18px; font-weight: bold; color: var(--gold); }
#topbar .brand .sub { font-size: 12px; color: var(--muted); margin-left: 8px; font-weight: normal; }
#topbar .meta { flex: 1; min-width: 0; color: var(--muted); font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }  /* P2-6：窄屏不换行，顶栏高度稳定 */
#topbar .controls { display: flex; gap: 14px; align-items: center; font-size: 13px; }
.toggle { cursor: pointer; user-select: none; color: var(--muted); }
.toggle input { accent-color: var(--gold); }
.toggle.inline { margin-top: 10px; font-size: 12px; }
button {
  background: #1f2647; color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 16px; cursor: pointer; font-size: 14px;
}
button:hover { border-color: var(--gold); }
button:active { transform: scale(.96); filter: brightness(1.25); }
button.primary { background: var(--gold); color: #20180a; font-weight: bold; border: none; }
button.primary:hover { filter: brightness(1.08); }
button.big { font-size: 17px; padding: 12px 34px; margin-top: 18px; }
button.ghost { background: transparent; }

/* ---------- 主区 ---------- */
main { flex: 1; display: flex; min-height: 0; }
#table-wrap { flex: 1; position: relative; min-width: 0; }
#table-felt {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(62%, 900px); height: min(74%, 460px);
  background: radial-gradient(ellipse at center, var(--felt1) 0%, var(--felt2) 78%);
  border: 10px solid #241a10; border-radius: 999px;
  box-shadow: inset 0 0 60px rgba(0,0,0,.55), 0 10px 40px rgba(0,0,0,.5);
}
#board {
  position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%);
  display: flex; gap: 8px;
}
#pot {
  position: absolute; left: 50%; top: 62%; transform: translate(-50%, -50%);
  background: rgba(0,0,0,.45); border: 1px solid rgba(216,180,90,.5);
  color: var(--gold); font-size: 16px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 4px 16px; border-radius: 999px;
}

/* ---------- 牌 ---------- */
.card {
  position: relative; font-size: 11px;
  width: 52px; height: 74px; background: #fdfcf7; border-radius: 7px;
  border: 1px solid #c9c4b4; box-shadow: 0 3px 8px rgba(0,0,0,.45);
  user-select: none;
  animation: cardIn .26s cubic-bezier(.2,.8,.3,1) backwards;
}
.card.d1 { animation-delay: .08s; }
.card.d2 { animation-delay: .16s; }
@keyframes cardIn { from { transform: translateY(-16px) rotate(-6deg) scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
.card .cc { position: absolute; display: flex; flex-direction: column; align-items: center; line-height: 1; gap: 1px; }
.card .cc.tl { top: .35em; left: .45em; }
.card .cc.br { bottom: .35em; right: .45em; transform: rotate(180deg); }
.card .ccr { font-weight: 700; font-size: 1.5em; letter-spacing: -.02em;
  text-shadow: 0 0 2px var(--card-face, #fdfcf7), 0 0 4px var(--card-face, #fdfcf7); }
.card .ccs { width: 1.15em; height: 1.15em; }
.card .ssvg { display: block; width: 100%; height: 100%; }
.card .ssvg path { fill: currentColor; }
.card .cpip { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.card .cpip .ssvg { width: 2.6em; height: 2.6em; opacity: .92; }
.card.red { color: var(--suit-red, #c8342e); }
.card.black { color: var(--suit-black, #1b1b1b); }
.card.back {
  background:
    radial-gradient(circle at 50% 50%, rgba(255,255,255,.22) 0 5px, transparent 6px) 50% 50% / 26px 26px repeat,
    repeating-linear-gradient(45deg, #274a8f 0 6px, #1c376c 6px 12px);
  border-color: #16295a;
}
.card.back::after { content: "♠"; color: rgba(255,255,255,.35); font-size: 26px; }
.card.small { font-size: 9px; width: 46px; height: 66px; }

/* ---------- 座位 ---------- */
.seat {
  position: absolute; transform: translate(-50%, -50%);
  width: 150px; padding: 8px 10px; border-radius: 12px;
  background: rgba(10, 20, 14, .88); border: 1px solid var(--line);
  text-align: center; transition: border-color .2s, box-shadow .2s;
}
.seat.active { border-color: var(--gold); box-shadow: 0 0 18px rgba(216,180,90,.35); }
.seat.winner { border-color: var(--green); box-shadow: 0 0 20px rgba(76,175,125,.5); }
.seat.folded { opacity: .38; }
.seat .name { font-size: 13px; color: var(--text); }
.seat .name .bot-tag { color: var(--blue); font-size: 10px; margin-left: 4px; }
.seat .stack { font-size: 12px; color: var(--gold); margin: 2px 0 4px; }
.seat .pos {
  position: absolute; top: -9px; left: -9px; background: var(--gold); color: #20180a;
  font-size: 10px; font-weight: bold; border-radius: 999px; padding: 2px 7px;
}
/* 遮挡审计 P1-1：上排座位（.seat-top，y<35%）的上溢物改向卡片下方弹出——
 * 位置徽章挂下缘、表情气泡向下翻，不再没入顶栏 */
.seat-top .pos { top: auto; bottom: -9px; }
.seat-top .emote { top: auto; bottom: -40px; transform: translate(-50%, -6px); }  /* 完全让开下挂徽章 */
.seat-top .emote.show { transform: translate(-50%, 0); }
.seat-top .emote::after {
  bottom: auto; top: -5px; border: 5px solid transparent;
  border-bottom-color: #fffdf6; border-top: none;
}
.seat .cards { display: flex; gap: 5px; justify-content: center; min-height: 54px; }
.seat .action { font-size: 12px; color: var(--muted); margin-top: 4px; min-height: 16px; }
.seat .action.bold { color: var(--text); }
.seat .thinking { color: var(--gold); font-size: 11px; animation: pulse 1s infinite; }
.seat .win-amt { color: var(--green); font-size: 12px; font-weight: bold; }
@keyframes pulse { 0%,100% { opacity: .4; } 50% { opacity: 1; } }

/* ---------- 侧栏 ---------- */
#side { width: 320px; border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.panel { border-bottom: 1px solid var(--line); padding: 12px 14px; }
.panel h3 { font-size: 14px; color: var(--gold); margin-bottom: 8px; }
.panel#logpanel { flex: 1; display: flex; flex-direction: column; min-height: 0; }
#log { flex: 1; overflow-y: auto; font-size: 12px; color: var(--muted); line-height: 1.7; }
#log .street { color: var(--gold); margin-top: 4px; }
#log .act b { color: var(--text); }
.muted { color: var(--muted); font-size: 12px; line-height: 1.6; }

/* 教练面板 */
#coach-body .row { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-size: 12px; }
#coach-body .bar { flex: 1; height: 8px; background: #1a2a20; border-radius: 999px; overflow: hidden; }
#coach-body .bar i { display: block; height: 100%; background: linear-gradient(90deg, #4caf7d, #d8b45a); }
#coach-body .suggest {
  margin-top: 8px; padding: 8px 10px; border: 1px solid var(--gold); border-radius: 8px;
  background: rgba(216,180,90,.08); font-size: 13px;
}
#coach-body .suggest b { color: var(--gold); }
#coach-body .kv { display: flex; justify-content: space-between; font-size: 12px; margin: 3px 0; }
#coach-body .kv span:last-child { color: var(--text); }

/* ---------- 操作栏 ---------- */
#actionbar {
  border-top: 1px solid var(--line); background: var(--panel);
  padding: 12px 18px; min-height: 86px;
  display: flex; align-items: center; gap: 14px;
}
#action-hint { color: var(--muted); font-size: 14px; }
#turn-clock { margin-left: auto; color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; }
#action-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
#action-controls button { font-size: 15px; padding: 10px 22px; font-weight: bold; }
#action-controls .fold { border-color: var(--red); color: #ff9d9d; }
#action-controls .call { border-color: var(--green); color: #9fe0bd; }
#action-controls .raise { border-color: var(--gold); color: var(--gold); }
#raise-box { display: flex; align-items: center; gap: 10px; }
#raise-slider { width: 180px; accent-color: var(--gold); }
#presets { display: flex; gap: 6px; }
#presets button { font-size: 13px; padding: 6px 12px; font-weight: normal; letter-spacing: .5px; }

/* ---------- 演出：筹码飞行 / 赢池星爆 / 樱瓣 / 全下聚焦 ---------- */
.khint {
  display: inline-block; margin-left: 6px; padding: 0 5px;
  border: 1px solid currentColor; border-radius: 4px;
  font-size: 10px; opacity: .7; font-weight: normal;
}
/* 快捷表情条（联机/单机通用）；靠左放，右侧是牌局日志不能盖 */
#emote-strip {
  position: fixed; left: 20px; bottom: 108px; z-index: 45;
  display: flex; flex-wrap: wrap; gap: 6px; max-width: 260px;
}
.emote-chip {
  font-size: 13px; padding: 5px 12px; border-radius: 999px;
  background: rgba(26, 33, 64, .92); border: 1.5px solid var(--gold); color: var(--text);
}
.emote-chip:hover { filter: brightness(1.15); }
#emote-fab { display: none; }   /* 桌面 chips 常显，浮标只在窄屏出现（遮挡审计 P0-1） */
.flychip {
  position: fixed; top: 0; left: 0; width: 12px; height: 12px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe9a8, #d8b45a);
  border: 1.5px solid #8a6a2a; z-index: 60; pointer-events: none;
}
.pchip {
  display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: -1.5px;
  margin-right: 5px; border: 1.5px dashed #8a6a2a;
  background: radial-gradient(circle at 35% 30%, #ffe9a8, #d8b45a);
}
.preset-suggest { animation: presetPulse 1.6s ease-in-out infinite; }
@keyframes presetPulse {
  0%, 100% { box-shadow: 0 0 0 rgba(255,158,199,0); }
  50% { box-shadow: 0 0 12px rgba(255,158,199,.8); }
}
.winburst { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 6; pointer-events: none; }
.winburst svg { width: 130px; height: 130px; animation: burst .85s ease-out forwards; }
@keyframes burst { 0% { transform: scale(.3) rotate(0deg); opacity: 0; } 30% { opacity: 1; } 100% { transform: scale(1.5) rotate(140deg); opacity: 0; } }
.petals { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 1; }
#seats { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
#seats .seat { pointer-events: auto; }
#board { z-index: 2; }
#pot { z-index: 2; }
.petals i { position: absolute; top: -6%; width: 14px; height: 11px; display: block; opacity: .85;
  background: radial-gradient(circle at 30% 30%, #ffd3e3, #ff9ec7);
  border-radius: 60% 40% 55% 45%; animation: petalFall linear infinite; }
@keyframes petalFall { to { transform: translateY(114vh) rotate(520deg); } }
body.runout .seat:not(.active) { opacity: .28; }
body.runout #table-felt { box-shadow: inset 0 0 140px rgba(0,0,0,.8), 0 10px 40px rgba(0,0,0,.5); }
body.runout #pot { filter: brightness(1.25); }
@media (prefers-reduced-motion: reduce) {
  .petals, .eyes, .hair-sway, .card, .char-card.sel, .winburst svg { animation: none !important; }
}
.hidden { display: none !important; }

/* ---------- 遮罩 ---------- */
#overlay, #start-modal, #multi-modal, #data-modal {
  position: fixed; inset: 0; background: rgba(4, 8, 10, .78);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
#overlay-card, #start-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 28px 34px; max-width: 560px; text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
/* 全身立绘等大资产会把弹窗撑高：限高 + 可滚动，保证「开始牌局」永远可达 */
#start-card { max-height: 92vh; overflow-y: auto; }
/* 全身服模式：弹窗加宽，抵消右栏放大对网格的挤压 */
#start-card.full-mode { max-width: 660px; }
#overlay-card h2 { color: var(--gold); margin-bottom: 12px; }
#overlay-body { font-size: 14px; line-height: 1.9; text-align: left; }
#overlay-body .win-line { color: var(--green); font-weight: bold; }
#overlay-body .win-line.gold { color: #f5c96b; }
#overlay-body .hole-line { color: var(--muted); font-size: 12px; }
#overlay-body .card { animation: none !important; }   /* 弹层里禁发牌动画：截图/读屏不再拿到空帧 */
.ov-board { display: flex; gap: 8px; justify-content: center; margin: 4px 0 8px; }
.ov-quotes {
  margin: 2px 0 8px; padding: 8px 12px; border: 1.5px solid var(--gold);
  border-radius: 12px; background: rgba(255, 158, 199, .08);
}
.ov-quote { font-size: 13px; color: var(--text); line-height: 1.8; }
.ov-quote b { color: var(--gold); }
#btn-next { margin-top: 16px; }

#start-card h1 { color: var(--gold); font-size: 26px; margin-bottom: 14px; }
#start-card .lead { font-size: 13px; color: var(--muted); line-height: 1.9; text-align: left; }
#start-card .opt-row { margin-top: 16px; font-size: 14px; color: var(--text); }
#start-card .opt-row label { margin: 0 8px; cursor: pointer; }
#start-card .opt-row input { accent-color: var(--gold); }
#start-card .foot { margin-top: 16px; font-size: 11px; color: var(--muted); }
#start-card code { color: var(--gold); }

/* ---------- 窄桌面（1024/1280）：座位卡收窄防越界，侧栏让位（遮挡审计 P1-4） ---------- */
@media (min-width: 861px) and (max-width: 1180px) {
  .seat { width: 132px; padding: 7px 8px; }
  .seat .name { font-size: 12px; }
  .seat .pos { font-size: 9px; padding: 2px 6px; }
  #side { width: 280px; }
}

/* ---------- 手机 / 窄屏 ---------- */
@media (max-width: 860px) {
  body { overflow: auto; height: auto; min-height: 100%; }
  #topbar { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  #topbar .brand { font-size: 15px; }
  #topbar .brand .sub { display: none; }
  #topbar .controls { font-size: 12px; gap: 10px; }

  main { flex-direction: column; padding-bottom: 108px; } /* 给固定操作栏留位 */
  #table-wrap { flex: none; height: 56vh; min-height: 330px; }
  #table-felt { width: 96%; height: 66%; }

  /* 遮挡审计 P0-1：表情 chips 固定 bottom 压住行动按钮（点击被拦截）——
   * 窄屏收成右下浮标，点击展开，选完即收 */
  #emote-strip {
    left: auto; right: 14px;
    bottom: calc(var(--actionbar-h, 64px) + 12px);   /* JS 实时写操作栏实高，换行也不压 */
    flex-direction: column; align-items: flex-end; max-width: none;
  }
  #emote-fab {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 40px; border-radius: 999px; cursor: pointer;
    font-size: 13px; background: rgba(26, 33, 64, .95);
    border: 1.5px solid var(--gold); color: var(--text);
  }
  #emote-strip .emote-chip { display: none; }
  #emote-strip.open .emote-chip { display: inline-block; }

  .seat { width: 100px; padding: 5px 6px; border-radius: 9px; }
  .seat .name { font-size: 11px; }
  .seat .name .bot-tag { font-size: 8px; }
  .seat .stack { font-size: 10px; margin: 1px 0 3px; }
  .seat .pos { font-size: 8px; padding: 1px 5px; top: -7px; left: -7px; }
  .seat .action { font-size: 10px; min-height: 13px; }
  .card { width: 38px; height: 54px; border-radius: 6px; }
  .card .r { font-size: 15px; } .card .s { font-size: 17px; }
  .card.small { width: 26px; height: 38px; }
  .card.small .r { font-size: 10px; } .card.small .s { font-size: 11px; }
  #board { gap: 5px; top: 40%; }
  #pot { font-size: 12px; top: 58%; white-space: nowrap; }

  #side { width: 100%; border-left: none; border-top: 1px solid var(--line); }
  #log { max-height: 200px; }
  #coach-body .row { font-size: 11px; }
  #coach-body .row span:first-child { width: 42px; }
  #coach-body .row span:last-child { width: 96px; }

  /* 操作栏固定在视口底部：任何时刻可点，不用滚动 */
  #actionbar {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
    flex-wrap: wrap; gap: 8px; padding: 10px 12px; min-height: 0;
    box-shadow: 0 -6px 20px rgba(0, 0, 0, .55);
  }
  #action-controls { gap: 8px; }
  #action-controls button { font-size: 14px; padding: 10px 16px; min-height: 41px; white-space: nowrap; }
  #raise-box { width: 100%; flex-wrap: nowrap; }
  #btn-raise { flex: none; min-width: 118px; }
  #raise-slider { flex: 1; width: auto; min-width: 90px; }
  #presets { flex: 1 1 100%; flex-wrap: wrap; }
  #presets button { min-height: 38px; }

  /* 摊牌结果改为底部抽屉，不遮挡牌桌 */
  #overlay { align-items: flex-end; }
  #overlay-card {
    width: 100%; max-width: none; margin: 0;
    border-radius: 16px 16px 0 0; max-height: 52vh; overflow-y: auto;
  }

  #start-card { margin: 16px; padding: 20px 18px; max-height: 86vh; overflow-y: auto; }
}

/* ==================== 好友房大厅（mp.js） ==================== */
.mp-row { display: flex; align-items: center; gap: 12px; margin: 12px 0; flex-wrap: wrap; }
.mp-row > b { flex-shrink: 0; }
.mp-input {
  background: var(--panel, rgba(20,14,26,.7));
  border: 1.5px solid var(--line, #4a3a55);
  border-radius: 8px; color: var(--fg, #f0e8f4);
  padding: 8px 12px; font-size: 14px; outline: none;
}
.mp-input:focus { border-color: var(--gold, #e8b96a); }
.mp-code { width: 10em; letter-spacing: 4px; font-size: 18px; text-transform: uppercase; }
.mp-tabs { display: flex; gap: 8px; margin: 14px 0 10px; }
.mp-tab {
  flex: 1; padding: 10px; border-radius: 10px; cursor: pointer;
  border: 1.5px solid var(--line, #4a3a55); background: transparent;
  color: var(--fg, #f0e8f4); font-size: 14px;
}
.mp-tab.sel { border-color: var(--gold, #e8b96a); color: var(--gold, #e8b96a); background: rgba(232,185,106,.07); }
#mp-room-code {
  font-size: 38px; font-weight: 700; letter-spacing: 10px;
  color: var(--gold, #e8b96a); text-align: center; line-height: 1.2;
  padding-left: 10px; /* 抵消字距造成的视觉偏移 */
}
.mp-players { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.mp-pl {
  display: flex; align-items: center; gap: 12px;
  padding: 6px 12px; border: 1px solid var(--line, #4a3a55); border-radius: 10px;
}
.mp-pl.empty { justify-content: center; color: var(--muted, #9a8aa8); font-size: 12px; border-style: dashed; }
.mp-pl .avatar { width: 46px; height: 46px; border-radius: 8px; overflow: hidden; flex-shrink: 0; }
.mp-tag {
  font-size: 11px; color: var(--gold, #e8b96a);
  border: 1px solid var(--gold, #e8b96a); border-radius: 6px; padding: 0 5px;
}
.mp-chars { display: flex; gap: 8px; flex-wrap: wrap; }
.mp-ch {
  width: 74px; padding: 6px 4px; text-align: center; cursor: pointer;
  border: 1.5px solid var(--line, #4a3a55); border-radius: 10px;
  transition: border-color .15s, transform .15s;
}
.mp-ch:hover { transform: translateY(-2px); }
.mp-ch.sel { border-color: var(--gold, #e8b96a); background: rgba(232,185,106,.08); }
.mp-ch-name { font-size: 11px; margin-top: 2px; }
.mp-tag.ok {
  color: #fff; border-color: #2fbf71; background: #2fbf71; font-weight: 700;
}
.mp-tag.wait { color: var(--muted, #9a8aa8); border-color: var(--muted, #9a8aa8); }
.mp-pl.notready { opacity: .68; }
#mp-lobby-status {
  text-align: center; font-size: 13px; min-height: 20px; margin: 4px 0;
  color: var(--muted);
}
#mp-lobby-status.allready { color: var(--gold); font-weight: 700; }
#mp-btn-start.attn { animation: startBreathe 1.2s ease-in-out infinite; }
@keyframes startBreathe {
  0%, 100% { box-shadow: 0 0 0 rgba(255, 158, 199, 0); }
  50% { box-shadow: 0 0 18px rgba(255, 158, 199, .8); }
}
#mp-btn-start:disabled { opacity: .45; cursor: not-allowed; }
