/* 像素俱乐部扑克 —— 复古像素风（Sweetie-16 调色板） */
@font-face {
  font-family: 'FusionPixel';
  src: url('../assets/fonts/fusion-pixel-12px-zh_hans.woff2') format('woff2');
  font-display: swap;
}
:root {
  --k: #1a1c2c; --p: #5d275d; --r: #b13e53; --o: #ef7d57; --y: #ffcd75; --l: #a7f070; --g: #38b764; --t: #257179;
  --n: #29366f; --b: #3b5dc9; --c: #41a6f6; --a: #73eff7; --w: #f4f4f4; --s: #94b0c2; --d: #566c86; --e: #333c57;
  --felt: #257146; --felt2: #1d5c39;
  --nav-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #0f1020; color: var(--w); }
body {
  font-family: 'FusionPixel', 'Zpix', 'SimSun', 'PingFang SC', 'Microsoft YaHei', monospace;
  font-size: 12px; line-height: 1.5; -webkit-font-smoothing: none; font-smooth: never;
  image-rendering: pixelated; user-select: none; -webkit-user-select: none;
  overscroll-behavior: none;
}
input, select, textarea, button { font: inherit; color: inherit; }
.pix { image-rendering: pixelated; image-rendering: crisp-edges; background-size: 100% 100%; background-repeat: no-repeat; display: inline-block; vertical-align: middle; }
.big { font-size: 24px; line-height: 1.2; }
.muted { color: var(--s); }
.gold { color: var(--y); }
.green { color: var(--l); }
.red { color: var(--o); }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.hide { display: none !important; }

/* ---------- 布局 ---------- */
#app {
  position: relative; max-width: 480px; height: 100%; margin: 0 auto; overflow: hidden;
  background:
    linear-gradient(rgba(26,28,44,.92), rgba(26,28,44,.92)),
    repeating-linear-gradient(0deg, #222541 0 2px, transparent 2px 8px),
    repeating-linear-gradient(90deg, #222541 0 2px, transparent 2px 8px);
  background-color: var(--k);
  box-shadow: 0 0 0 4px #000;
}
.view { position: absolute; inset: 0 0 calc(var(--nav-h) + var(--safe-b)) 0; overflow-y: auto; padding: 0 10px 16px; -webkit-overflow-scrolling: touch; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; padding: 10px 0 8px; background: var(--k); border-bottom: 2px solid var(--e); margin-bottom: 10px; }
.topbar .title { font-size: 24px; color: var(--y); text-shadow: 2px 2px 0 var(--r); letter-spacing: 1px; }

/* 底部导航 */
#nav { position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b); display: flex; background: var(--e); border-top: 4px solid #000; z-index: 20; }
#nav button { flex: 1; background: none; border: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--s); cursor: pointer; }
#nav button .pix { width: 24px; height: 24px; }
#nav button.on { color: var(--y); background: var(--n); box-shadow: inset 0 4px 0 var(--y); }

/* ---------- 像素框/按钮 ---------- */
.box { background: var(--e); border: 2px solid #000; box-shadow: inset -3px -3px 0 rgba(0,0,0,.35), inset 3px 3px 0 rgba(255,255,255,.12), 3px 3px 0 #000; padding: 10px; margin-bottom: 12px; }
.box.dark { background: #20223a; }
.box h3 { margin: 0 0 8px; font-size: 12px; color: var(--y); font-weight: normal; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px; padding: 4px 12px; border: 2px solid #000; background: var(--b); color: var(--w); cursor: pointer;
  box-shadow: inset -3px -3px 0 rgba(0,0,0,.35), inset 3px 3px 0 rgba(255,255,255,.3), 2px 2px 0 #000; white-space: nowrap; }
.btn:active:not(:disabled) { transform: translate(2px,2px); box-shadow: inset 3px 3px 0 rgba(0,0,0,.35); }
.btn:disabled { filter: grayscale(.8) brightness(.7); cursor: not-allowed; }
.btn.y { background: var(--y); color: var(--k); }
.btn.g { background: var(--g); }
.btn.r { background: var(--r); }
.btn.o { background: var(--o); color: var(--k); }
.btn.k { background: var(--d); }
.btn.sm { min-height: 24px; padding: 2px 8px; }
.btn.block { display: flex; width: 100%; }
.btn.lg { min-height: 44px; font-size: 24px; }
.tag { display: inline-block; padding: 0 5px; border: 2px solid #000; background: var(--d); color: var(--w); line-height: 16px; }
.tag.y { background: var(--y); color: var(--k); } .tag.g { background: var(--g); } .tag.r { background: var(--r); } .tag.b { background: var(--b); } .tag.p { background: var(--p); } .tag.t { background: var(--t); }

.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; border: 2px solid #000; background: var(--e); color: var(--s); padding: 3px 10px; cursor: pointer; box-shadow: 2px 2px 0 #000; }
.tabs button.on { background: var(--y); color: var(--k); }
.seg { display: flex; border: 2px solid #000; margin-bottom: 10px; box-shadow: 2px 2px 0 #000; }
.seg button { flex: 1; border: 0; padding: 6px; background: var(--e); color: var(--s); cursor: pointer; }
.seg button + button { border-left: 2px solid #000; }
.seg button.on { background: var(--b); color: var(--w); }

.field { display: block; margin-bottom: 10px; }
.field > span { display: block; color: var(--s); margin-bottom: 3px; }
.field input, .field select, .field textarea, .inp { width: 100%; padding: 6px 8px; background: #0f1020; border: 2px solid #000; box-shadow: inset 2px 2px 0 rgba(0,0,0,.6); color: var(--w); outline: none; border-radius: 0; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--y); }
.field textarea { min-height: 80px; resize: vertical; }
input[type=range] { width: 100%; accent-color: var(--y); }

/* 资产胶囊 */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 4px; background: #0f1020; border: 2px solid #000; }
.pill .pix { width: 18px; height: 18px; }
.ico-chip, .ico-chip-b, .ico-chip-g, .ico-chip-k, .ico-dia { image-rendering: pixelated; background-size: 100% 100%; display: inline-block; vertical-align: middle; width: 18px; height: 18px; }
.av { image-rendering: pixelated; background-size: 100% 100%; display: inline-block; width: 40px; height: 40px; border: 2px solid #000; box-shadow: 2px 2px 0 #000; background-color: var(--d); flex: none; }
.av.sm { width: 28px; height: 28px; } .av.lg { width: 64px; height: 64px; }

/* ---------- 大厅 ---------- */
.banner { background: linear-gradient(90deg, var(--p), var(--r)); }
.tbl { display: flex; gap: 10px; align-items: stretch; cursor: pointer; }
.tbl:active { filter: brightness(1.15); }
.tbl .mode-ico { width: 52px; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--felt); border: 2px solid #000; box-shadow: inset 0 0 0 2px var(--felt2); }
.tbl .mode-ico .s-big { width: 21px; height: 24px; }
.tbl .mode-ico small { font-size: 12px; color: var(--y); }
.tbl .info { flex: 1; min-width: 0; }
.tbl .name { color: var(--w); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbl .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 8px; color: var(--s); }
.tbl .grid b { color: var(--w); font-weight: normal; }
.tbl .go { display: flex; flex-direction: column; justify-content: center; gap: 4px; align-items: flex-end; }
.dots { display: inline-flex; gap: 2px; vertical-align: middle; }
.dots i { width: 6px; height: 6px; background: var(--d); display: inline-block; }
.dots i.f { background: var(--l); }
.empty { text-align: center; color: var(--s); padding: 24px 0; }
.fab { position: sticky; bottom: 8px; display: flex; justify-content: center; pointer-events: none; }
.fab .btn { pointer-events: auto; }

/* ---------- 弹窗 ---------- */
#modal { position: absolute; inset: 0; z-index: 100; background: rgba(15,16,32,.78); display: flex; align-items: flex-end; justify-content: center; }
#modal .sheet { width: 100%; max-height: 88%; overflow-y: auto; background: var(--e); border-top: 4px solid #000; box-shadow: inset 0 4px 0 var(--d); padding: 12px; animation: up .18s steps(4); }
#modal .sheet h2 { margin: 0 0 10px; font-size: 24px; font-weight: normal; color: var(--y); text-shadow: 2px 2px 0 #000; }
@keyframes up { from { transform: translateY(40%); } to { transform: none; } }
#toast { position: absolute; left: 50%; top: 18%; transform: translateX(-50%); z-index: 200; padding: 6px 14px; background: var(--y); color: var(--k); border: 2px solid #000; box-shadow: 3px 3px 0 #000; pointer-events: none; animation: pop .15s steps(3); max-width: 90%; text-align: center; }
@keyframes pop { from { transform: translateX(-50%) scale(.6); } }

/* ---------- 列表 ---------- */
.list .item { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 2px dashed var(--d); }
.list .item:last-child { border-bottom: 0; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.stat { background: #0f1020; border: 2px solid #000; padding: 6px 4px; text-align: center; }
.stat .v { font-size: 24px; line-height: 1.1; }
.stat .k { color: var(--s); }
details.faq { border: 2px solid #000; background: #20223a; margin-bottom: 6px; }
details.faq summary { padding: 8px; cursor: pointer; color: var(--y); list-style: none; }
details.faq summary::before { content: '▶ '; }
details.faq[open] summary::before { content: '▼ '; }
details.faq .body { padding: 0 10px 10px; color: var(--w); }
.rank-row { display: flex; align-items: center; gap: 6px; padding: 4px 0; border-bottom: 1px dashed var(--d); }
.rank-row .nm { width: 64px; flex: none; color: var(--y); }

/* ---------- 牌 ---------- */
.card { position: relative; display: inline-block; width: 40px; height: 56px; background: var(--w); color: var(--k); border: 2px solid #000; box-shadow: inset -2px -2px 0 var(--s), 2px 2px 0 rgba(0,0,0,.6); flex: none; vertical-align: middle; }
.card .r { position: absolute; left: 3px; top: 0; font-size: 24px; line-height: 24px; letter-spacing: -2px; }
.card .s { position: absolute; image-rendering: pixelated; background-size: 100% 100%; }
.card .s.mini { left: 4px; top: 25px; width: 10px; height: 11px; }
.card .s.main { right: 3px; bottom: 3px; width: 17px; height: 19px; }
.card.red { color: var(--r); }
.card.back { background: var(--r); box-shadow: inset 0 0 0 2px var(--y), inset 0 0 0 4px var(--r), 2px 2px 0 rgba(0,0,0,.6);
  background-image: repeating-conic-gradient(var(--p) 0 25%, var(--r) 0 50%); background-size: 6px 6px; }
.card.slot { background: rgba(0,0,0,.15); border: 2px dashed rgba(244,244,244,.25); box-shadow: none; }
.card.lg { width: 46px; height: 64px; }
.card.lg .s.main { width: 21px; height: 24px; }
.card.sm { width: 22px; height: 30px; border-width: 2px; box-shadow: 1px 1px 0 rgba(0,0,0,.6); }
.card.sm .r { font-size: 12px; line-height: 12px; left: 2px; top: 0; letter-spacing: -1px; }
.card.sm .s.mini { display: none; }
.card.sm .s.main { width: 10px; height: 11px; right: 2px; bottom: 2px; }
.card.win { box-shadow: 0 0 0 2px var(--y), 0 0 0 4px #000; transform: translateY(-4px); }
.card.dim { filter: brightness(.55); }
.card.deal { animation: deal .25s steps(5); }
@keyframes deal { from { transform: translateY(-30px) scale(.5); opacity: 0; } }
.cards { display: inline-flex; gap: 3px; }
.cards.tight .card + .card { margin-left: -10px; }
.cards.tight.five .card + .card { margin-left: -12px; }

/* ---------- 牌桌 ---------- */
#table { position: absolute; inset: 0; z-index: 50; display: flex; flex-direction: column; background: #10121f; }
#table .tbar { display: flex; align-items: center; gap: 6px; padding: 6px 8px; background: var(--e); border-bottom: 3px solid #000; }
#table .tbar .ttl { flex: 1; min-width: 0; line-height: 1.3; }
#table .tbar .ttl b { color: var(--y); font-weight: normal; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.felt-wrap { position: relative; flex: 1; min-height: 300px; }
.felt { position: absolute; left: 13%; right: 13%; top: 9%; bottom: 13%; border-radius: 48% / 34%; background: var(--felt);
  border: 4px solid #000; box-shadow: inset 0 0 0 6px #6b3d1e, inset 0 0 0 9px #000, inset 0 0 0 12px var(--felt2), 0 6px 0 #000;
  background-image: radial-gradient(rgba(255,255,255,.08) 1px, transparent 1px); background-size: 6px 6px; }
.felt .logo { position: absolute; left: 0; right: 0; top: 58%; text-align: center; color: rgba(167,240,112,.25); }
.center-area { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); text-align: center; width: 76%; }
.center-area .pot { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; background: rgba(0,0,0,.45); border: 2px solid #000; color: var(--y); margin-bottom: 6px; }
.center-area .board { display: flex; justify-content: center; gap: 3px; }
.center-area .board .card { width: 34px; height: 48px; }
.center-area .board .card .r { font-size: 24px; }
.center-area .board .card .s.main { width: 14px; height: 16px; }
.center-area .board .card .s.mini { top: 23px; width: 8px; height: 9px; }
.center-area .msg { margin-top: 6px; min-height: 18px; color: var(--w); text-shadow: 1px 1px 0 #000; }
.center-area .msg .hl { color: var(--y); }
.seat { position: absolute; transform: translate(-50%, -50%); width: 84px; text-align: center; z-index: 2; }
.seat .plate { position: relative; display: inline-flex; flex-direction: column; align-items: center; }
.seat .av { width: 38px; height: 38px; }
.seat .nm { max-width: 84px; padding: 0 3px; background: rgba(15,16,32,.85); border: 2px solid #000; margin-top: -4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; }
.seat .ch { color: var(--y); background: rgba(15,16,32,.85); border: 2px solid #000; border-top: 0; padding: 0 3px; min-width: 56px; }
.seat.turn .av { box-shadow: 0 0 0 2px var(--y), 0 0 0 4px #000; animation: blink .6s steps(2) infinite; }
@keyframes blink { 50% { box-shadow: 0 0 0 2px var(--o), 0 0 0 4px #000; } }
.seat.folded { opacity: .45; }
.seat.empty .av { background: transparent; border-style: dashed; border-color: var(--d); box-shadow: none; }
.seat .act { position: absolute; left: 50%; top: -18px; transform: translateX(-50%); white-space: nowrap; padding: 0 4px; background: var(--w); color: var(--k); border: 2px solid #000; z-index: 3; }
.seat .act.fold { background: var(--d); color: var(--w); }
.seat .act.raise { background: var(--o); }
.seat .act.allin { background: var(--r); color: var(--w); }
.seat .hc { position: absolute; top: 4px; display: flex; }
.seat .hc.right { left: 64px; } .seat .hc.left { right: 64px; }
.seat .hc .card.sm { width: 16px; height: 22px; }
.seat .hc .card.sm + .card.sm { margin-left: -9px; }
.seat .shown { margin-top: 2px; display: flex; justify-content: center; }
.seat .shown .card.sm + .card.sm { margin-left: -4px; }
.seat .hn { color: var(--l); text-shadow: 1px 1px 0 #000; white-space: nowrap; }
.seat .win-amt { color: var(--y); text-shadow: 1px 1px 0 #000; animation: pop2 .3s steps(3); }
@keyframes pop2 { from { transform: scale(.4); } }
.betchip { position: absolute; transform: translate(-50%, -50%); display: inline-flex; align-items: center; gap: 2px; padding: 0 4px 0 0; background: rgba(0,0,0,.55); border: 2px solid #000; color: var(--w); z-index: 1; white-space: nowrap; }
.betchip .ico-chip { width: 14px; height: 14px; }
.dealer { position: absolute; width: 18px; height: 18px; line-height: 14px; background: var(--w); color: var(--k); border: 2px solid #000; text-align: center; transform: translate(-50%, -50%); z-index: 1; box-shadow: 1px 1px 0 #000; }
.me-panel { background: var(--e); border-top: 4px solid #000; padding: 8px 8px calc(8px + var(--safe-b)); }
.me-panel .mine { display: flex; align-items: center; gap: 8px; min-height: 68px; }
.me-panel .mine .info { flex: 1; min-width: 0; }
.me-panel .mine .hand-name { color: var(--l); }
.actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-top: 6px; }
.actions .btn { min-height: 42px; }
.raise-panel { margin-top: 6px; background: #20223a; border: 2px solid #000; padding: 8px; }
.raise-panel .presets { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin: 6px 0; }
.wait { text-align: center; color: var(--s); padding: 12px 0; }
.timer { color: var(--a); }
.timer.low { color: var(--o); }
