/* ─────────────────────────────────────────────────────────────
   设计系统（玩家 App、运营后台、荷官台共用）：夜场贵宾厅
   · 材质而不是渐变：藏青台呢、胡桃木桌边、象牙牌面
   · 颜色各有唯一含义：香槟金 = 钱；朱砂 = 品牌、直播、危险；玉色 = 在线 / 正常
   · 字体全部用系统字体（国内无法稳定加载网络字体）：
     标题宋体，正文苹方 / 思源黑体，金额 DIN 等宽数字
   ───────────────────────────────────────────────────────────── */
:root {
  --night: #12161d;
  --deck: #191e27;
  --deck-2: #212734;
  --hair: rgba(236, 230, 218, .08);
  --hair-2: rgba(236, 230, 218, .14);
  --ivory: #ece6da;
  --mute: #9aa1ae;
  --dim: #6a7181;
  --gold: #d4af6a;
  --gold-hi: #ecd39e;
  --gold-lo: #8e7140;
  --seal: #c4402f;
  --seal-hi: #e0725f;
  --jade: #6fbf98;
  --baize: #1c4266;
  --baize-deep: #10273f;
  --walnut: #3a2318;
  --walnut-hi: #6a412a;
  --stock: #f3eee4;
  --suit-red: #b8352a;
  --suit-black: #1b1f27;

  /* 旧变量名，映射到新色板 */
  --ink: var(--night); --ink-2: var(--deck); --ink-3: var(--deck-2);
  --line: var(--hair-2); --line-soft: var(--hair);
  --brass: var(--gold); --brass-hi: var(--gold-hi);
  --mint: var(--jade); --red: var(--seal-hi);
  --card: var(--stock); --felt: var(--baize); --felt-deep: var(--baize-deep); --rail: var(--walnut);

  --serif: "Songti SC", "STSongti-SC-Bold", "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;
  --ui: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --num: "DIN Alternate", "Bahnschrift", "Roboto Condensed", "DIN Condensed", "Arial Narrow", var(--ui);
  --weave: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--night); color: var(--ivory); font: 14px/1.5 var(--ui); -webkit-font-smoothing: antialiased; }
a { color: var(--brass-hi); text-decoration: none; }
a:hover { text-decoration: underline; }
.num { font-family: var(--num); font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.muted { color: var(--mute); }
.dim { color: var(--dim); }
h1 { font: 700 18px/1.3 var(--serif); margin: 0; letter-spacing: .06em; }
h2 { font-size: 14px; font-weight: 600; margin: 0 0 10px; color: var(--ivory); }
kbd { font: 11px var(--num); border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; opacity: .55; margin-left: 6px; }
:focus-visible { outline: 2px solid var(--brass-hi); outline-offset: 2px; }

/* 按钮 */
button {
  font: 500 14px var(--ui); color: var(--ivory); background: var(--ink-3);
  border: 1px solid var(--hair-2); border-radius: var(--r-sm); padding: 8px 14px; cursor: pointer;
  transition: background .15s, border-color .15s;
}
button:hover:not(:disabled) { border-color: var(--mute); }
button:disabled { opacity: .35; cursor: not-allowed; }
button.primary { background: var(--gold); border-color: var(--gold); color: #241a08; font-weight: 600; }
button.primary:hover:not(:disabled) { background: var(--brass-hi); border-color: var(--brass-hi); }
button.go { background: var(--ivory); border-color: var(--ivory); color: #171b22; font-weight: 600; }
button.ok { background: rgba(111,191,152,.14); border-color: rgba(111,191,152,.4); color: var(--jade); }
button.danger { background: transparent; border-color: var(--red); color: var(--red); }
button.danger:hover:not(:disabled) { background: rgba(196,64,47,.12); }
button.ghost { background: transparent; border-color: transparent; color: var(--mute); }
button.ghost:hover:not(:disabled) { color: var(--ivory); border-color: var(--line); }
button.on { border-color: var(--gold); color: var(--gold-hi); background: rgba(212,175,106,.08); }
input, select {
  font: 14px var(--ui); background: var(--ink); color: var(--ivory);
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px;
}
input:focus { border-color: var(--brass); outline: none; }
input[type=range] { accent-color: var(--brass); padding: 0; border: 0; background: transparent; }

/* 通用布局 */
.wrap { max-width: 1240px; margin: 0 auto; padding: 16px; }
.bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.panel { background: var(--deck); border-radius: var(--r-lg); padding: 18px; box-shadow: inset 0 0 0 1px var(--hair); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 6px; font-size: 12px; background: rgba(236,230,218,.06); color: var(--mute); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.on { color: var(--jade); background: rgba(111,191,152,.1); }
.pill.off { color: var(--seal-hi); background: rgba(196,64,47,.12); }
.big { font: 600 26px/1.2 var(--num); }
.log { max-height: 220px; overflow: auto; font-size: 13px; line-height: 1.75; }
.log > div { border-bottom: 1px solid var(--line-soft); padding: 2px 0; }
table.list { width: 100%; border-collapse: collapse; font-size: 13px; }
table.list th { text-align: left; font-weight: 500; font-size: 12px; color: var(--dim); padding: 8px 10px; border-bottom: 1px solid var(--hair-2); letter-spacing: .04em; }
table.list td { padding: 11px 10px; border-bottom: 1px solid var(--hair); }
table.list tbody tr:last-child td { border-bottom: 0; }
.alert { box-shadow: inset 3px 0 0 var(--seal); padding: 7px 12px; margin-bottom: 6px; background: rgba(196,64,47,.08); font-size: 13px; border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.banner { padding: 10px 14px; border-radius: var(--r-sm); margin-bottom: 10px; font-weight: 500; display: none; font-size: 13px; }
.banner.warn { background: rgba(201,164,92,.12); border: 1px solid rgba(201,164,92,.5); color: var(--brass-hi); }
.banner.err { background: rgba(224,105,90,.12); border: 1px solid rgba(224,105,90,.5); color: #f2a79c; }
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 50;
  background: rgba(236,230,218,.95); border: 0; color: #171b22; font-weight: 500;
  padding: 10px 18px; border-radius: 999px; display: none; box-shadow: 0 12px 30px rgba(0,0,0,.5);
}

/* ── 牌 ─────────────────────────────────────────────── */
.card {
  --w: 44px; position: relative; display: inline-block; width: var(--w); height: calc(var(--w) * 1.4);
  border-radius: calc(var(--w) * .09); margin: 0 2px; vertical-align: middle;
  color: var(--suit-black);
  box-shadow: 0 1px 0 rgba(0,0,0,.25), 0 3px 8px rgba(0,0,0,.35);
}
.card .front {
  position: absolute; inset: 0; border-radius: inherit; background: var(--stock); overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}
.card.red { color: var(--suit-red); }
.card .ci { position: absolute; left: 9%; top: 6%; display: flex; flex-direction: column; align-items: center; line-height: .95; }
.card .ci b { font: 700 calc(var(--w) * .34) var(--num); }
.card .ci i { font-style: normal; font-size: calc(var(--w) * .26); }
.card .cp { position: absolute; right: 10%; bottom: 6%; font-size: calc(var(--w) * .52); line-height: 1; }
.card.back .front, .card.reveal::after {
  background:
    radial-gradient(circle at 50% 50%, var(--seal) 0 14%, transparent 15%),
    repeating-linear-gradient(45deg, rgba(212,175,106,.28) 0 1px, transparent 1px 6px),
    repeating-linear-gradient(-45deg, rgba(212,175,106,.28) 0 1px, transparent 1px 6px),
    #172d4a;
  box-shadow: inset 0 0 0 2px var(--stock), inset 0 0 0 3.5px #172d4a, inset 0 0 0 4.5px rgba(212,175,106,.6);
}
/* 牌背：酒红底金色花纹贴图（玩家端、荷官台、后台共用）；贴图加载不到时退回上面的纹样 */
.card.back .front, .card.reveal::after { background: url(/app/img/card-back.webp) center / cover no-repeat, #5a1420; box-shadow: inset 0 0 0 1.5px var(--stock); }
.card.sm { --w: 30px; }
.card.sm .cp { display: none; }
.card.sm .ci { left: 0; right: 0; top: 10%; }
.card.sm .ci b { font-size: 15px; } .card.sm .ci i { font-size: 13px; }
.card.md { --w: 50px; }
.card.lg { --w: 78px; }
.card.deal { animation: card-in .32s ease-out; }
@keyframes card-in { from { transform: translateY(-10px); opacity: 0; } to { transform: none; opacity: 1; } }
/* 自己的底牌：从牌背翻到牌面 —— 只有你能看到这一面。
   用 2D 的横向压缩实现翻转（不依赖 3D 背面隐藏，各浏览器表现一致） */
.card.reveal::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  animation: card-back-hide .8s both;
}
.card.reveal { animation: card-flip .8s cubic-bezier(.3,.7,.2,1) both; }
@keyframes card-flip {
  0% { transform: translateY(-12px) scaleX(1); }
  40% { transform: translateY(-8px) scaleX(1); }
  60% { transform: translateY(-4px) scaleX(0); }
  100% { transform: none; }
}
@keyframes card-back-hide { 0%, 59.9% { opacity: 1; } 60%, 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .card.reveal, .card.deal { animation: none; }
  .card.reveal::after { animation: none; opacity: 0; }
}

/* ── 筹码 ───────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 6px; font: 600 13px var(--num); color: var(--brass-hi);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.chip::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%; flex: none;
  background: radial-gradient(circle, var(--gold) 0 40%, var(--gold-lo) 41% 47%, transparent 48%), repeating-conic-gradient(var(--stock) 0 15deg, var(--gold) 15deg 45deg);
  box-shadow: 0 0 0 1px var(--gold-lo), 0 1px 2px rgba(0,0,0,.6);
}

@media (max-width: 760px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .wrap { padding: 12px; }
}

/* 品牌 logo（各端共用，和 App 图标同一张图） */
.seal { flex: none; display: block; width: 30px; height: 30px; border-radius: 22%; background: #000 url(app/img/logo.webp) center / cover no-repeat; box-shadow: 0 4px 12px rgba(0,0,0,.45), 0 0 0 1px rgba(212,175,106,.28); }
.seal svg { display: none; }
.wordmark { font: 900 19px/1 var(--serif); letter-spacing: .06em; color: var(--ivory); white-space: nowrap; }
@keyframes breathe { 50% { opacity: .3; } }

/* ── 头像：筹码样式的圆章，宝石色 + 宋体首字 ── */
.avatar-c, .ps .av { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font: 700 15px var(--serif); color: #f1e9da; letter-spacing: 0;
  background: var(--av, #4a3a2a); box-shadow: inset 0 0 0 2px var(--av, #4a3a2a), inset 0 0 0 3px rgba(241,233,218,.28), 0 2px 6px rgba(0,0,0,.35); }
.av0 { --av: #7a5a2c; } .av1 { --av: #2f5e4e; } .av2 { --av: #6e2f38; } .av3 { --av: #33497a; }
.av4 { --av: #5d5a2f; } .av5 { --av: #5a3c69; } .av6 { --av: #2b5b6b; } .av7 { --av: #7a4b37; }


/* ── 牌桌俯视缩略图（大厅、后台概览共用） ── */
.mt { position: absolute; inset: 26px 30px 20px; }
.mt-rail { position: absolute; inset: 0; border-radius: 50%; background: linear-gradient(170deg, var(--walnut-hi), var(--walnut) 40%, #24150e); box-shadow: 0 14px 26px rgba(0,0,0,.45); }
.mt-felt { position: absolute; inset: 9px; border-radius: 50%; background: var(--weave), radial-gradient(ellipse at 50% 40%, #255480, var(--baize) 60%, var(--baize-deep)); box-shadow: 0 0 0 1px rgba(212,175,106,.4), inset 0 6px 18px rgba(0,0,0,.35); }
.mt-dealer { position: absolute; left: 50%; top: -9px; transform: translateX(-50%); z-index: 2; display: inline-flex; align-items: center; gap: 5px; font-size: 11px; letter-spacing: .1em; color: var(--ivory); background: #0e1218; padding: 2px 9px; border-radius: 4px; box-shadow: 0 0 0 1px rgba(212,175,106,.45); white-space: nowrap; }
.mt-mid { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -46%); display: flex; flex-direction: column; align-items: center; gap: 5px; }
.mt-board { display: flex; gap: 3px; }
.mt-board .card { --w: 21px; margin: 0; box-shadow: 0 1px 2px rgba(0,0,0,.4); }
.mt-board .card .ci { left: 0; right: 0; top: 8%; }
.mt-board .card .ci b { font-size: 11px; } .mt-board .card .ci i { font-size: 10px; }
.mt-board .card .cp { display: none; }
.mt-board .slot { width: 21px; height: 29px; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(236,230,218,.16); }
.mt-pot { font-size: 11px; }
.mt-pot .chip { font-size: 12px; gap: 4px; } .mt-pot .chip::before { width: 10px; height: 10px; }
.mt-idle { font: 600 12px var(--serif); letter-spacing: .3em; color: rgba(236,230,218,.4); }
.mt-seat { position: absolute; transform: translate(-50%, -50%); z-index: 1; }
.mt-seat .avatar-c { width: 28px; height: 28px; font-size: 11px; box-shadow: inset 0 0 0 1.5px var(--av), inset 0 0 0 2.5px rgba(241,233,218,.3), 0 0 0 2px #0f1319; }
.mt-seat.vacant { width: 22px; height: 22px; border-radius: 50%; background: rgba(15,19,25,.75); box-shadow: inset 0 0 0 1px rgba(236,230,218,.18); }
.mt-seat.folded .avatar-c, .mt-seat.away .avatar-c { filter: grayscale(.85) brightness(.55); }
.mt-seat.acting .avatar-c { box-shadow: inset 0 0 0 1.5px var(--av), inset 0 0 0 2.5px rgba(241,233,218,.3), 0 0 0 2px #0f1319, 0 0 0 3.5px var(--gold); }
.mt-btn { position: absolute; transform: translate(-50%, -50%); width: 12px; height: 12px; border-radius: 50%; background: var(--stock); color: #20180a; font: 700 7px/12px var(--num); text-align: center; z-index: 2; box-shadow: 0 1px 2px rgba(0,0,0,.5); }

.mt-seat.bot::after { content: "AI"; position: absolute; right: -5px; bottom: -3px; font: 700 7px/1 var(--num); color: #171b22; background: var(--mute); padding: 1px 2px; border-radius: 3px; }

/* 上传的头像照片：铺满圆形，不显示缩写 */
.avatar-c.ph, .ps .av.ph { background-color: #1b1611; background-size: cover; background-position: center; color: transparent; }
.toast.link { cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* 分享图预览（App 和分享页共用）：系统分享面板不能带图片时，弹出图片让玩家长按保存或下载 */
.shot-mask { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(5,7,10,.82); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade .18s; }
.shot { width: min(360px, 100%); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.shot img { width: 100%; max-height: 66vh; object-fit: contain; border-radius: 14px; box-shadow: 0 18px 40px rgba(0,0,0,.6); -webkit-touch-callout: default; user-select: auto; }
.shot p { margin: 4px 0 0; color: var(--mute); font-size: 13px; letter-spacing: .08em; }
.shot a, .shot button { width: 100%; padding: 12px; border-radius: 12px; font: 500 15px var(--ui); letter-spacing: .1em; text-align: center; }
.shot a { background: var(--gold); color: #241a08; font-weight: 600; text-decoration: none; }
.shot button { background: none; border: 1px solid var(--hair-2); color: var(--ivory); }
@keyframes fade { from { opacity: 0; } }

/* ── 商城装扮（App 牌桌 / 我的 / 商城预览、后台预览共用） ── */
/* 头像框：.frm 盖在头像外圈，fr-* 是款式；用遮罩只留一圈环 */
.frm { position: absolute; inset: -4px; border-radius: 50%; padding: 3px; pointer-events: none; display: none;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); mask-composite: exclude; }
.frm[class*=fr-] { display: block; }
.fr-gold { background: conic-gradient(from 210deg, #8e7140, #f7e4b0, #c9a35c, #fff4d2, #9c7a40, #ecd39e, #8e7140); }
.fr-platinum { background: conic-gradient(from 200deg, #6f747c, #f4f6f8, #a9aeb6, #ffffff, #7d828a, #dfe3e8, #6f747c); }
.fr-jade { background: conic-gradient(from 220deg, #1d5a44, #9fe0c0, #2f8a64, #d6f5e6, #1d5a44, #6fbf98, #1d5a44); }
.fr-ruby { background: conic-gradient(from 200deg, #6e1a1e, #f0a090, #b8302f, #ffd2c4, #7a1f22, #e0725f, #6e1a1e); }
.fr-onyx { padding: 3.5px; background: conic-gradient(from 0deg, #0b0a08 0 20deg, #d4af6a 20deg 40deg, #0b0a08 40deg 80deg, #d4af6a 80deg 100deg, #0b0a08 100deg 140deg, #d4af6a 140deg 160deg, #0b0a08 160deg 200deg, #d4af6a 200deg 220deg, #0b0a08 220deg 260deg, #d4af6a 260deg 280deg, #0b0a08 280deg 320deg, #d4af6a 320deg 340deg, #0b0a08 340deg); }
.fr-diamond { padding: 3.5px; background: conic-gradient(#bfe6ff, #ffffff, #e6c8ff, #a6d8ff, #ffffff, #ffe2b8, #bfe6ff); animation: frSpin 6s linear infinite; }
@keyframes frSpin { to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) { .fr-diamond { animation: none; } }

/* 台呢：盖在台面上，用"颜色"混合只换色相，保留原图的绒面质感和灯光 */
.felt-skin { position: absolute; left: 29.3%; top: 17%; width: 41.4%; height: 52%; z-index: 0; border-radius: 999px; pointer-events: none; display: none; mix-blend-mode: color; }
[data-felt=emerald] .felt-skin { display: block; background: #1f8a58; }
[data-felt=burgundy] .felt-skin { display: block; background: #9a2436; }
[data-felt=onyx] .felt-skin { display: block; background: #5a5a5a; }
[data-felt=royal] .felt-skin { display: block; background: #57307f; }
[data-felt=teal] .felt-skin { display: block; background: #13828c; }

/* 牌背 */
[data-back] .card.back .front, [data-back] .card.reveal::after { box-shadow: inset 0 0 0 1.5px var(--stock), inset 0 0 0 3px var(--cb, #0b0a08), inset 0 0 0 3.8px rgba(212,175,106,.75); }
[data-back=onyx] { --cb: #0b0a08; }
[data-back=onyx] .card.back .front, [data-back=onyx] .card.reveal::after { background: radial-gradient(circle, #d4af6a 0 9%, transparent 10%), repeating-linear-gradient(45deg, rgba(212,175,106,.38) 0 1px, transparent 1px 5px), repeating-linear-gradient(-45deg, rgba(212,175,106,.38) 0 1px, transparent 1px 5px), linear-gradient(160deg, #1d1a14, #0b0a08); }
[data-back=emerald] { --cb: #0a2a1f; }
[data-back=emerald] .card.back .front, [data-back=emerald] .card.reveal::after { background: repeating-linear-gradient(45deg, rgba(236,211,158,.26) 0 1px, transparent 1px 5px), repeating-linear-gradient(-45deg, rgba(236,211,158,.26) 0 1px, transparent 1px 5px), linear-gradient(160deg, #165a42, #0a2a1f); }
[data-back=navy] { --cb: #0d1f3d; }
[data-back=navy] .card.back .front, [data-back=navy] .card.reveal::after { background: radial-gradient(rgba(236,211,158,.45) 0.8px, transparent 1.2px) 0 0 / 5px 5px, linear-gradient(160deg, #22467e, #0d1f3d); }
[data-back=ivory] { --cb: #e9dfc8; }
[data-back=ivory] .card.back .front, [data-back=ivory] .card.reveal::after { background: radial-gradient(circle, #8e7140 0 9%, transparent 10%), repeating-linear-gradient(45deg, rgba(142,113,64,.3) 0 1px, transparent 1px 5px), repeating-linear-gradient(-45deg, rgba(142,113,64,.3) 0 1px, transparent 1px 5px), #f1e9d6; }
[data-back=plum] { --cb: #24102a; }
[data-back=plum] .card.back .front, [data-back=plum] .card.reveal::after { background: repeating-linear-gradient(90deg, rgba(236,211,158,.24) 0 1px, transparent 1px 4px), linear-gradient(160deg, #57295e, #24102a); }
