:root {
  --bg: #08110d;
  --bg-2: #0e1c16;
  --felt: #175640;
  --felt-2: #0f3a2c;
  --line: rgba(255, 255, 255, .09);
  --text: #e9f2ec;
  --muted: #87a396;
  --gold: #e8c27a;
  --green: #35c08a;
  --red: #e0584e;
  --card: #fbf8f0;
  --card-line: #d8d2c4;
  --radius: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  overscroll-behavior: none;
}

body {
  background:
    radial-gradient(120% 70% at 50% -10%, #16352a 0%, transparent 60%),
    radial-gradient(90% 50% at 50% 110%, #103227 0%, transparent 60%),
    var(--bg);
}

.app { max-width: 560px; margin: 0 auto; min-height: 100%; position: relative; }

.view { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.view[hidden] { display: none; }

/* ---------- 首页 ---------- */
#view-home { padding: 0 18px calc(28px + var(--safe-b)); justify-content: center; }

.hero { text-align: center; padding: 40px 0 26px; }
.hero-ball {
  width: 62px; height: 62px; margin: 0 auto 14px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #ececec 45%, #c2c2c2);
  color: #101010; font-weight: 800; font-size: 20px;
  display: grid; place-items: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5), inset 0 -3px 8px rgba(0, 0, 0, .16);
  position: relative;
}
.hero-ball::after {
  content: ''; position: absolute; inset: 12px; border-radius: 50%;
  border: 2px solid #101010; z-index: 0;
}
.hero-ball span { position: relative; z-index: 1; }
.hero h1 { font-size: 30px; margin: 0 0 8px; letter-spacing: 4px; font-weight: 700; }
.hero-sub { margin: 0; color: var(--muted); font-size: 13px; letter-spacing: .5px; }

.panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, .055), rgba(255, 255, 255, .02));
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  backdrop-filter: blur(12px);
}

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 7px; letter-spacing: 1px; }

input {
  width: 100%; height: 48px; padding: 0 14px; border-radius: 12px;
  background: rgba(0, 0, 0, .32); border: 1px solid var(--line);
  color: var(--text); font-size: 16px; outline: none; transition: border-color .15s;
}
input::placeholder { color: #5c7268; }
input:focus { border-color: rgba(53, 192, 138, .55); }

.btn {
  height: 48px; padding: 0 20px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, .07); color: var(--text);
  font-size: 15px; font-weight: 600; cursor: pointer; transition: transform .1s, background .15s;
  font-family: inherit;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(180deg, #3fd39a, #22a877); color: #04180f; border-color: transparent; box-shadow: 0 8px 22px rgba(53, 192, 138, .25); }
.btn.block { display: block; width: 100%; }
.btn.ghost { background: transparent; }
.btn.danger { color: #ff8d84; border-color: rgba(224, 88, 78, .35); background: rgba(224, 88, 78, .1); }
.btn:disabled { opacity: .4; pointer-events: none; }
.btn.sm { height: 38px; padding: 0 14px; font-size: 13px; border-radius: 10px; }

.divider { display: flex; align-items: center; gap: 10px; margin: 16px 0; color: #5c7268; font-size: 11px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.join-row { display: flex; gap: 10px; }
.join-row input { flex: 1; letter-spacing: 6px; text-align: center; font-size: 18px; font-weight: 600; }
.join-row .btn { flex: 0 0 88px; }

.rules { margin-top: 18px; border: 1px solid var(--line); border-radius: 14px; padding: 0 16px; background: rgba(0, 0, 0, .18); }
.rules summary { cursor: pointer; padding: 13px 0; font-size: 13px; color: var(--muted); list-style: none; display: flex; align-items: center; gap: 6px; }
.rules summary::-webkit-details-marker { display: none; }
.rules summary::before { content: '◇'; color: var(--gold); font-size: 11px; }
.rules[open] summary::before { content: '◆'; }
.rules-body { padding-bottom: 14px; font-size: 12.5px; line-height: 1.85; color: #a9c1b5; }
.rules-body p { margin: 0 0 8px; }
.rules-body b { color: var(--text); }

/* ---------- 房间顶栏 ---------- */
.topbar {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px 10px;
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(180deg, rgba(8, 17, 13, .96), rgba(8, 17, 13, .72));
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-mid { flex: 1; text-align: center; }
.room-code { font-size: 19px; font-weight: 800; letter-spacing: 6px; color: var(--gold); line-height: 1.15; }
.room-meta { font-size: 11px; color: var(--muted); margin-top: 2px; letter-spacing: .5px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, .05); color: var(--text); font-size: 17px;
  display: grid; place-items: center; cursor: pointer; font-family: inherit;
}
.icon-btn:active { background: rgba(255, 255, 255, .12); }

main { flex: 1; padding: 14px 14px 130px; }

/* ---------- 玩家条 ---------- */
.players { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.players::-webkit-scrollbar { display: none; }
.pchip {
  flex: 0 0 auto; min-width: 76px; padding: 8px 10px; border-radius: 12px;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--line);
  position: relative; transition: border-color .2s, background .2s;
}
.pchip.me { border-color: rgba(53, 192, 138, .5); background: rgba(53, 192, 138, .1); }
.pchip.turn { box-shadow: 0 0 0 2px rgba(232, 194, 122, .55); }
.pchip.out { opacity: .45; }
.pchip .pname { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 82px; }
.pchip .pcount { font-size: 11px; color: var(--muted); margin-top: 3px; }
.pchip .pcount b { color: var(--green); font-size: 14px; }
.pchip .dot { position: absolute; top: 7px; right: 8px; width: 6px; height: 6px; border-radius: 50%; background: #456; }
.pchip .dot.on { background: var(--green); box-shadow: 0 0 6px var(--green); }

/* ---------- 台面 ---------- */
.felt {
  position: relative; border-radius: 18px; padding: 14px;
  background:
    radial-gradient(90% 80% at 50% 0%, rgba(255, 255, 255, .07), transparent 60%),
    linear-gradient(180deg, var(--felt), var(--felt-2));
  border: 1px solid rgba(255, 255, 255, .1);
  box-shadow: inset 0 0 50px rgba(0, 0, 0, .45), 0 12px 30px rgba(0, 0, 0, .35);
}
.felt-head { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: #b9d6c8; margin-bottom: 10px; letter-spacing: .5px; }
.balls { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.ball {
  aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: #fff;
  background: radial-gradient(circle at 34% 30%, #ffffff55, rgba(0, 0, 0, .28));
  border: 1px solid rgba(255, 255, 255, .16);
  transition: all .25s;
  position: relative;
}
.ball.potted {
  background: rgba(0, 0, 0, .35); color: #4c6157;
  border-color: rgba(255, 255, 255, .06); text-decoration: line-through;
}
.ball.potted::after {
  content: '✓'; position: absolute; top: -3px; right: -3px;
  width: 13px; height: 13px; border-radius: 50%;
  background: #0d1a15; color: #5fe0ac; font-size: 9px;
  display: grid; place-items: center; border: 1px solid rgba(95, 224, 172, .35);
}

/* ---------- 手牌 ---------- */
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 20px 2px 10px; font-size: 12px; color: var(--muted); letter-spacing: 1px; }
.section-title b { color: var(--text); font-size: 13px; }

.hand { display: flex; flex-wrap: wrap; gap: 9px; }
.pcard {
  width: 62px; height: 88px; border-radius: 9px; background: var(--card);
  color: #17181a; position: relative; padding: 7px 6px;
  border: 1px solid var(--card-line); cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .35);
  transition: transform .12s, box-shadow .12s;
  display: flex; flex-direction: column; justify-content: space-between;
  user-select: none;
}
.pcard:active { transform: translateY(-4px) scale(1.03); box-shadow: 0 10px 20px rgba(0, 0, 0, .45); }
.pcard.red { color: #c2382c; }
.pcard .rk { font-size: 21px; font-weight: 800; line-height: 1; letter-spacing: -.5px; }
.pcard .st { font-size: 15px; line-height: 1; }
.pcard .sn { position: absolute; right: 6px; bottom: 6px; font-size: 9px; color: #9a9484; letter-spacing: -.2px; }
.pcard.joker .rk { font-size: 13px; line-height: 1.1; }
.pcard.joker .st { font-size: 20px; }

.empty-hint { padding: 22px; text-align: center; color: var(--muted); font-size: 13px; border: 1px dashed var(--line); border-radius: 14px; }

/* ---------- 弃牌记录 ---------- */
.log-list { display: flex; flex-direction: column; gap: 1px; background: var(--line); border-radius: 12px; overflow: hidden; }
.log-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #0d1a15; font-size: 12.5px; }
.log-row .tag { font-size: 10px; padding: 2px 7px; border-radius: 20px; flex: 0 0 auto; }
.tag.pot { background: rgba(53, 192, 138, .16); color: #5fe0ac; }
.tag.void { background: rgba(255, 255, 255, .07); color: #8fa89b; }
.tag.pen { background: rgba(224, 88, 78, .16); color: #ff9d95; }
.log-row .who { color: var(--text); font-weight: 600; }
.log-row .cd { margin-left: auto; color: var(--gold); font-weight: 700; font-size: 12px; }
.log-row .tm { color: #5c7268; font-size: 10.5px; }

.timeline { display: flex; flex-direction: column; gap: 9px; }
.tl-item { display: flex; gap: 9px; font-size: 12px; color: #a9c1b5; line-height: 1.5; }
.tl-item .t { color: #5c7268; flex: 0 0 44px; font-variant-numeric: tabular-nums; }

/* ---------- 大厅 ---------- */
.lobby-box { text-align: center; padding: 22px 0 8px; }
.lobby-box h2 { font-size: 17px; margin: 0 0 6px; }
.lobby-box p { color: var(--muted); font-size: 12.5px; margin: 0 0 20px; line-height: 1.7; }
.seat-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.seat { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 12px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); }
.seat .av { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #06170f; }
.seat .nm { font-size: 13.5px; font-weight: 600; }
.seat .rl { margin-left: auto; font-size: 11px; color: var(--gold); }
.seat.off .nm { color: var(--muted); }
.hint { font-size: 11.5px; color: var(--muted); text-align: center; line-height: 1.7; margin: 12px 0 0; }

/* ---------- 底部操作条 ---------- */
.actionbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  max-width: 560px; margin: 0 auto;
  padding: 10px 12px calc(12px + var(--safe-b));
  display: flex; gap: 7px;
  background: linear-gradient(180deg, rgba(8, 17, 13, 0), rgba(8, 17, 13, .95) 30%);
  backdrop-filter: blur(10px);
}
.actionbar[hidden] { display: none; }
.connection-strip { display:flex; align-items:center; flex-wrap:wrap; justify-content:center; gap:8px; color:var(--gold); }
.connection-strip:has([role="status"]:not([hidden])) { padding:8px 12px; background:#2a2317; }
.connection-strip .btn { font-size:12px; min-height:32px; }
.quick-balls { display:grid; grid-template-columns:repeat(auto-fit,minmax(80px,1fr)); gap:8px; }
.cast-qr img { width:min(220px,80vw); height:auto; border-radius:12px; background:#fff; padding:8px; }
.scoreboard .app { max-width:1200px; }
.cast-view { padding:clamp(16px,4vw,48px); gap:clamp(18px,4vw,38px); }
.cast-head { display:flex; justify-content:space-between; align-items:baseline; gap:16px; }
.cast-head p { color:var(--gold); margin:0 0 6px; font-size:clamp(.85rem,2vw,1.25rem); }
.cast-head h1 { font-size:clamp(1.15rem,3.5vw,2.5rem); margin:0; }
#cast-turn { font-size:clamp(1.6rem,5vw,3.8rem); color:var(--gold); margin:0; text-align:center; }
#cast-balls { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:clamp(5px,1vw,12px); }
#cast-balls .ball { width:auto; height:auto; aspect-ratio:1; font-size:clamp(.9rem,3vw,1.9rem); }
#cast-players { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(240px,100%),1fr)); gap:10px; }
.cast-seat { display:flex; justify-content:space-between; align-items:center; gap:12px; font-size:clamp(1rem,2vw,1.7rem); background:#122b21; padding:12px 16px; border:1px solid #3b594d; border-radius:12px; }
.cast-seat.current { border-color:var(--gold); }
.cast-seat span { overflow-wrap:anywhere; }
.cast-seat b { white-space:nowrap; color:var(--gold); }
@media (min-width:650px) { #cast-balls { grid-template-columns:repeat(15,minmax(0,1fr)); } }
.actionbar .btn { height: 44px; padding: 0 6px; font-size: 12.5px; border-radius: 11px; }

/* ---------- 新增：旁观 / 横幅 / 榜单 / 犯规项 ---------- */
.spec-line {
  font-size: 11.5px; color: var(--muted); margin: -4px 0 12px; padding-left: 2px;
}
.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 13px; border-radius: 11px; margin-bottom: 12px;
  background: rgba(255, 255, 255, .045); border: 1px solid var(--line);
  font-size: 12.5px; color: var(--muted);
}
.banner.gold { background: rgba(232, 194, 122, .12); border-color: rgba(232, 194, 122, .28); color: var(--gold); }
.banner .link { color: #8fa89b; text-decoration: underline; cursor: pointer; }

.turn-mine.flash { animation: turnFlash .8s ease 2; }
@keyframes turnFlash { 0%, 100% { color: var(--text) } 50% { color: var(--gold) } }

.ball.tap { cursor: pointer; }
.ball.tap:active { transform: scale(.9); border-color: rgba(232, 194, 122, .7); }
.pchip.waiting { opacity: .7; border-style: dashed; }

.board-row {
  display: flex; align-items: center; gap: 10px; padding: 11px 13px; border-radius: 12px;
  background: rgba(255, 255, 255, .04); border: 1px solid var(--line); margin-bottom: 8px;
}
.board-row.top { background: linear-gradient(90deg, rgba(232, 194, 122, .16), rgba(232, 194, 122, .02)); border-color: rgba(232, 194, 122, .38); }
.board-sub { font-size: 11px; color: var(--muted); margin-top: 4px; }
.board-win { flex: 0 0 auto; font-size: 18px; font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; }
.board-win span { font-size: 10px; color: var(--muted); margin-left: 2px; font-weight: 400; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  padding: 7px 12px; border-radius: 100px; font-size: 12px; cursor: pointer;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--line); color: var(--muted);
  transition: all .15s;
}
.chip.on { background: rgba(53, 192, 138, .16); border-color: rgba(53, 192, 138, .45); color: #6fe3b4; }
.btn.sm { height: 38px; padding: 0 14px; font-size: 12.5px; border-radius: 10px; }

.link-btn {
  display: block; width: 100%; margin-top: 12px; padding: 8px;
  background: none; border: none; color: var(--muted); font-size: 12px;
  text-decoration: underline; cursor: pointer; font-family: inherit;
}

/* ---------- 底部弹层 ---------- */
.sheet-mask {
  position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .62);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .16s ease;
}
.sheet-mask[hidden] { display: none; }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.sheet {
  width: 100%; max-width: 560px; max-height: 86vh; overflow-y: auto;
  background: #101f19; border: 1px solid var(--line); border-bottom: none;
  border-radius: 22px 22px 0 0; padding: 16px 16px calc(18px + var(--safe-b));
  animation: up .22s cubic-bezier(.22, .8, .3, 1);
}
@keyframes up { from { transform: translateY(24px); opacity: .4 } to { transform: none; opacity: 1 } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sheet-head h3 { font-size: 16px; margin: 0; }
.sheet-actions { display: flex; flex-direction: column; gap: 9px; margin-top: 16px; }
.sheet-actions .btn { width: 100%; }

.opt { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 13px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); margin-bottom: 9px; cursor: pointer; }
.opt:active { background: rgba(255, 255, 255, .09); }
.opt .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 16px; background: rgba(255, 255, 255, .07); }
.opt .txt { flex: 1; }
.opt .txt b { display: block; font-size: 13.5px; font-weight: 600; }
.opt .txt span { font-size: 11.5px; color: var(--muted); }

.stepper { display: flex; align-items: center; justify-content: space-between; padding: 6px 0 14px; }
.stepper .lb { font-size: 13px; color: var(--muted); }
.stepper .ctrl { display: flex; align-items: center; gap: 4px; }
.stepper .val { width: 54px; text-align: center; font-size: 20px; font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; }

/* ---------- 结算 ---------- */
.result-row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: rgba(255, 255, 255, .04); margin-bottom: 8px; border: 1px solid var(--line); }
.result-row.win { background: linear-gradient(90deg, rgba(232, 194, 122, .18), rgba(232, 194, 122, .03)); border-color: rgba(232, 194, 122, .4); }
.result-row .rk { width: 24px; font-size: 15px; font-weight: 800; color: var(--gold); text-align: center; }
.result-row .nm { flex: 1; font-size: 14px; font-weight: 600; }
.result-row .rs { font-size: 12px; color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  z-index: 90; background: rgba(20, 34, 28, .97); border: 1px solid var(--line);
  color: var(--text); padding: 11px 18px; border-radius: 100px; font-size: 13px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5); max-width: 86vw; text-align: center;
  animation: fade .15s;
}
.toast[hidden] { display: none; }

.spinner { width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, .25); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg) } }

/* ---------- 结算页 ---------- */
.end-mask {
  position: fixed; inset: 0; z-index: 80; overflow-y: auto;
  display: flex; align-items: center; justify-content: center;
  padding: 26px 18px calc(26px + var(--safe-b));
  background: radial-gradient(120% 80% at 50% 0%, #0f2e23 0%, #08110d 62%);
  animation: fade .22s ease;
}
.end-mask[hidden] { display: none; }
.end-mask.win { background: radial-gradient(120% 80% at 50% 0%, #3d3116 0%, #12150e 52%, #08110d 100%); }
.end-glow {
  position: absolute; top: -20%; left: 50%; width: 460px; height: 460px;
  transform: translateX(-50%); border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(232, 194, 122, .26), transparent 62%);
  filter: blur(4px);
  animation: glowPulse 3.4s ease-in-out infinite;
}
.end-mask.lose .end-glow { background: radial-gradient(circle, rgba(53, 192, 138, .13), transparent 62%); }
@keyframes glowPulse {
  0%, 100% { opacity: .72; transform: translateX(-50%) scale(1); }
  50% { opacity: 1; transform: translateX(-50%) scale(1.09); }
}
.end-inner { position: relative; width: 100%; max-width: 420px; text-align: center; }
.end-hero { padding: 2px 0 20px; }
.end-badge {
  width: 78px; height: 78px; margin: 0 auto 14px; border-radius: 50%;
  display: grid; place-items: center; font-size: 34px;
  background: radial-gradient(circle at 35% 28%, #4d3f1d, #221b0b);
  border: 1px solid rgba(232, 194, 122, .45);
  box-shadow: 0 0 0 6px rgba(232, 194, 122, .06), 0 14px 34px rgba(0, 0, 0, .5);
  animation: badgeIn .45s cubic-bezier(.2, 1.3, .4, 1);
}
.end-mask.lose .end-badge {
  background: radial-gradient(circle at 35% 28%, #1d2b24, #0f1915);
  border-color: rgba(255, 255, 255, .13);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .4);
  animation: none;
}
@keyframes badgeIn { from { transform: scale(.6); opacity: 0 } to { transform: none; opacity: 1 } }
.end-hero h2 { margin: 0 0 8px; font-size: 26px; letter-spacing: 3px; font-weight: 800; }
.end-mask.win .end-hero h2 { color: var(--gold); }
.end-hero p { margin: 0; font-size: 13px; color: var(--muted); }

.end-rank { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.rank-row {
  display: flex; align-items: center; gap: 11px; padding: 12px 14px; border-radius: 13px;
  background: rgba(255, 255, 255, .045); border: 1px solid var(--line); text-align: left;
}
.rank-row.first { background: linear-gradient(90deg, rgba(232, 194, 122, .18), rgba(232, 194, 122, .02)); border-color: rgba(232, 194, 122, .42); }
.rank-row.me { box-shadow: inset 0 0 0 1px rgba(53, 192, 138, .35); }
.rk-badge {
  width: 26px; height: 26px; flex: 0 0 auto; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; font-weight: 800;
  background: rgba(255, 255, 255, .07); color: var(--muted);
}
.rank-row.first .rk-badge { background: linear-gradient(180deg, #f3d79b, #c39f4c); color: #241b08; }
.rank-mid { flex: 1; min-width: 0; }
.rank-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-name em { font-style: normal; font-size: 10.5px; color: var(--green); margin-left: 5px; }
.rank-bar { height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .08); margin-top: 7px; overflow: hidden; }
.rank-bar i { display: block; height: 100%; border-radius: 2px; background: linear-gradient(90deg, #3fd39a, #22a877); transition: width .5s ease; }
.rank-row.first .rank-bar i { background: linear-gradient(90deg, #f0d49a, #c9a24d); }
.rank-rs { flex: 0 0 auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rank-row.first .rank-rs { color: var(--gold); }

.end-stats { display: flex; gap: 8px; margin-bottom: 20px; }
.stat { flex: 1; padding: 12px 6px; border-radius: 12px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); }
.stat b { display: block; font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat span { font-size: 10.5px; color: var(--muted); letter-spacing: .5px; }
.end-actions { display: flex; flex-direction: column; gap: 9px; }
.end-wait {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 15px; border-radius: 12px; border: 1px dashed rgba(255, 255, 255, .14);
  color: var(--muted); font-size: 13px;
}
.end-wait i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--green);
  animation: waitPulse 1.6s ease-in-out infinite;
}
@keyframes waitPulse { 0%, 100% { opacity: .25; transform: scale(.8) } 50% { opacity: 1; transform: scale(1.15) } }
.end-foot { margin: 18px 0 0; font-size: 11px; color: #4f665b; letter-spacing: .5px; }
.end-mask.win .btn.primary {
  background: linear-gradient(180deg, #f3d89d, #c9a24d);
  color: #241b08;
  box-shadow: 0 8px 24px rgba(232, 194, 122, .28);
}

.muted { color: var(--muted); }
.center { text-align: center; }
.kv { display: flex; justify-content: space-between; font-size: 12.5px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: none; }
.kv b { color: var(--gold); }
