:root {
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Hiragino Sans GB", system-ui, sans-serif;
  --num: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --cw: 84px;
  --ch: calc(var(--cw) * 1.4);
  --red: #d23b3b;
  --black: #1c2126;
  --gold: #d9b45b;
  --radius: 14px;
}
body[data-theme="jade"]   { --bg1: #14473d; --bg2: #0a2622; --accent: #d9b45b; --panel: rgba(8, 30, 26, .72); --line: rgba(255,255,255,.08); }
body[data-theme="ink"]    { --bg1: #243044; --bg2: #0d121b; --accent: #8fb8ff; --panel: rgba(10, 14, 22, .75); --line: rgba(255,255,255,.07); }
body[data-theme="claret"] { --bg1: #5a1f2a; --bg2: #220a10; --accent: #f0c27a; --panel: rgba(30, 8, 13, .72); --line: rgba(255,255,255,.08); }
body[data-theme="sand"]   { --bg1: #6b5b45; --bg2: #2e261c; --accent: #f3d9a4; --panel: rgba(36, 29, 20, .72); --line: rgba(255,255,255,.09); }
body[data-theme="gold"]   { --bg1: #3b3320; --bg2: #0f0d08; --accent: #f5cf63; --panel: rgba(18, 15, 8, .78); --line: rgba(245,207,99,.12); }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font-family: var(--font);
  color: #f3f1ea;
  background: radial-gradient(ellipse at 50% 42%, var(--bg1) 0%, var(--bg2) 78%);
  user-select: none;
  -webkit-user-select: none;
}
#app { position: relative; width: 100vw; height: 100vh; }
button { font-family: inherit; }

/* ---------- 通用按钮 ---------- */
.btn {
  appearance: none; border: 1px solid rgba(255,255,255,.18); cursor: pointer;
  background: rgba(255,255,255,.08); color: #fff;
  padding: 10px 22px; border-radius: 999px; font-size: 16px; letter-spacing: .08em;
  transition: transform .12s, background .15s, opacity .15s, box-shadow .15s;
}
.btn:hover { background: rgba(255,255,255,.16); }
.btn:active { transform: scale(.96); }
.btn.primary { background: var(--accent); color: #1b1a14; border-color: transparent; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn[disabled] { opacity: .35; pointer-events: none; }
.btn.small { padding: 6px 14px; font-size: 13px; }
.btn.ghost { background: transparent; }
.iconbtn {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line);
  background: rgba(255,255,255,.06); color: #fff; cursor: pointer; font-size: 16px;
  display: inline-grid; place-items: center;
}
.iconbtn:hover { background: rgba(255,255,255,.14); }
.iconbtn.off { opacity: .45; }

/* ---------- 大厅 ---------- */
.lobby { position: absolute; inset: 0; display: grid; place-items: center; }
.lobby-inner { width: min(880px, 92vw); display: grid; grid-template-columns: 1.1fr 1fr; gap: 28px; align-items: center; }
.brand h1 { font-size: 88px; margin: 0; letter-spacing: .12em; font-weight: 700; line-height: 1; }
.brand h1 span { color: var(--accent); }
.brand p { opacity: .6; letter-spacing: .3em; margin: 14px 0 34px; }
.brand .actions { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.brand .actions .btn { min-width: 220px; text-align: left; padding: 14px 26px; font-size: 17px; }
.brand .actions .btn small { opacity: .6; margin-left: 10px; font-size: 12px; letter-spacing: .04em; }
.brand .links { display: flex; gap: 8px; margin-top: 18px; }

.rankcard {
  background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 28px;
  backdrop-filter: blur(6px); box-shadow: 0 30px 60px rgba(0,0,0,.3);
}
.rank-emblem { display: flex; align-items: center; gap: 18px; }
.emblem {
  width: 84px; height: 84px; border-radius: 22px; display: grid; place-items: center;
  font-size: 34px; font-weight: 700; color: #fff; transform: rotate(45deg);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.25), 0 10px 30px rgba(0,0,0,.35);
}
.emblem > span { transform: rotate(-45deg); }
.rank-name { font-size: 28px; font-weight: 700; letter-spacing: .06em; }
.rank-sub { opacity: .6; font-size: 13px; margin-top: 4px; }
.stars { display: flex; gap: 6px; margin: 26px 0 6px; }
.star { width: 22px; height: 22px; clip-path: polygon(50% 0,61% 35%,98% 35%,68% 57%,79% 91%,50% 70%,21% 91%,32% 57%,2% 35%,39% 35%); background: rgba(255,255,255,.14); }
.star.on { background: var(--accent); }
.star.pop { animation: starpop .6s ease; }
.star.lose { animation: starlose .6s ease forwards; }
@keyframes starpop { 0% { transform: scale(.2); } 60% { transform: scale(1.5); } 100% { transform: scale(1); } }
@keyframes starlose { 0% { background: var(--accent); } 100% { background: rgba(255,255,255,.14); transform: scale(.8); } }
.lvrow { display: flex; justify-content: space-between; font-size: 13px; opacity: .8; margin-top: 18px; }
.bar { height: 6px; background: rgba(255,255,255,.1); border-radius: 6px; overflow: hidden; margin-top: 8px; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 6px; transition: width .8s ease; }
.statgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 22px; }
.statgrid div { background: rgba(255,255,255,.05); border-radius: 12px; padding: 10px 12px; }
.statgrid b { display: block; font-family: var(--num); font-size: 20px; }
.statgrid span { font-size: 12px; opacity: .6; }
.diff-note { margin-top: 16px; font-size: 12px; opacity: .55; line-height: 1.6; }

/* ---------- 牌桌 ---------- */
.table { position: absolute; inset: 0; }
.topbar {
  position: absolute; left: 0; right: 0; top: 0; height: 56px; padding: 0 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: linear-gradient(rgba(0,0,0,.25), transparent);
  z-index: 20;
}
.levels { display: flex; gap: 10px; align-items: center; }
.lvchip { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,.07); border: 1px solid var(--line); font-size: 13px; }
.lvchip b { font-family: var(--num); font-size: 18px; }
.lvchip.playing { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.lvchip .fails { font-size: 11px; opacity: .7; }
.handno { opacity: .6; font-size: 13px; letter-spacing: .1em; }
.tools { display: flex; gap: 8px; align-items: center; }
.rankmini { font-size: 13px; padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,.07); border: 1px solid var(--line); }
.rankmini i { font-style: normal; font-weight: 700; }

.center-level {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font-size: 13px; letter-spacing: .3em; opacity: .12; pointer-events: none; text-align: center;
}
.center-level b { display: block; font-size: 110px; letter-spacing: 0; font-family: var(--num); line-height: 1; }

.seat { position: absolute; display: flex; align-items: center; gap: 12px; z-index: 5; }
.seat.top { top: 64px; left: 50%; transform: translateX(-50%); flex-direction: row; }
.seat.left { left: 22px; top: 40%; transform: translateY(-50%); flex-direction: column; }
.seat.right { right: 22px; top: 40%; transform: translateY(-50%); flex-direction: column; }
.seat.bottom { left: 22px; bottom: calc(var(--hh) + 22px); }
.avatar {
  width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; position: relative;
  background: rgba(255,255,255,.1); border: 2px solid rgba(255,255,255,.18); font-size: 22px; font-weight: 600;
  transition: box-shadow .2s, border-color .2s;
}
.avatar.team0 { background: rgba(217,180,91,.18); }
.avatar.active { border-color: var(--accent); box-shadow: 0 0 0 6px rgba(255,255,255,.06), 0 0 24px var(--accent); }
.avatar .place { position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%); background: var(--accent); color: #1b1a14; font-size: 11px; padding: 1px 7px; border-radius: 999px; white-space: nowrap; font-weight: 600; }
.seatinfo { text-align: center; font-size: 13px; }
.seatinfo .name { font-weight: 600; }
.seatinfo .role { opacity: .55; font-size: 11px; }
.count {
  margin-top: 4px; display: inline-flex; align-items: center; gap: 4px; font-family: var(--num);
  background: rgba(0,0,0,.3); border-radius: 8px; padding: 2px 8px; font-size: 14px;
}
.count.warn { background: #c9463d; color: #fff; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(201,70,61,.25); } }
.thinking { display: inline-flex; gap: 3px; margin-left: 6px; }
.thinking i { width: 4px; height: 4px; border-radius: 50%; background: #fff; opacity: .3; animation: blink 1s infinite; }
.thinking i:nth-child(2) { animation-delay: .2s; } .thinking i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 50% { opacity: 1; } }

.playzone { position: absolute; display: flex; justify-content: center; align-items: center; pointer-events: none; z-index: 4; min-height: calc(var(--ch) * .72); }
.playzone.top { top: 150px; left: 50%; transform: translateX(-50%); }
.playzone.left { left: 130px; top: 40%; transform: translateY(-50%); justify-content: flex-start; }
.playzone.right { right: 130px; top: 40%; transform: translateY(-50%); justify-content: flex-end; }
.playzone.bottom { bottom: calc(var(--hh) + 82px); left: 50%; transform: translateX(-50%); }
.played { display: flex; flex-direction: column; align-items: center; gap: 6px; animation: dropin .28s ease-out; }
.played .row { display: flex; }
.played .row .card { margin-left: calc(var(--cw) * -.46); }
.played .row .card:first-child { margin-left: 0; }
.played .tag { font-size: 12px; padding: 2px 10px; border-radius: 999px; background: rgba(0,0,0,.35); letter-spacing: .1em; }
.played .tag.bomb { background: var(--red); }
.played .card { --cw: var(--pw); }
.played.reveal { gap: 4px; }
.played.reveal .card { --cw: calc(var(--pw) * .82); }
.played.reveal .row .card { margin-left: calc(var(--cw) * -.62); }
.passtag { font-size: 22px; letter-spacing: .3em; opacity: .75; animation: dropin .25s ease-out; }
@keyframes dropin { from { opacity: 0; transform: translateY(10px) scale(.94); } }

/* ---------- 牌 ---------- */
.card {
  width: var(--cw); height: var(--ch); border-radius: calc(var(--cw) * .1);
  background: linear-gradient(#fff, #f4f1ea); color: var(--black); position: relative; flex: none;
  box-shadow: 0 1px 0 rgba(0,0,0,.05), 0 4px 12px rgba(0,0,0,.28);
  font-family: var(--num);
}
.card.red { color: var(--red); }
.card .idx { position: absolute; left: 7%; top: 4%; display: flex; align-items: baseline; gap: 1px; line-height: 1; }
.card .idx .r { font-size: calc(var(--cw) * .28); font-weight: 700; letter-spacing: -.05em; }
.card .idx .s { font-size: calc(var(--cw) * .22); }
.card .pip { position: absolute; right: 9%; bottom: 6%; font-size: calc(var(--cw) * .56); line-height: 1; opacity: .92; }
.card.joker .idx .r { font-size: calc(var(--cw) * .2); letter-spacing: .02em; font-family: var(--font); font-weight: 800; }
.card.joker .pip { font-size: calc(var(--cw) * .46); right: 10%; bottom: 8%; }
.card.bigj { background: linear-gradient(#fff, #fbeeea); }
.card.bigj { color: #c7362f; }
.card.smallj { color: #22262b; }
.card.level { box-shadow: inset 0 0 0 2px var(--gold), 0 4px 12px rgba(0,0,0,.28); }
.card .wildtag {
  position: absolute; right: 6%; top: 4%; font-family: var(--font); font-size: calc(var(--cw) * .15);
  background: var(--gold); color: #3a2a06; padding: 1px 4px; border-radius: 4px; font-weight: 700;
}
.card.back { background: repeating-linear-gradient(45deg, #2d6b5e 0 6px, #25594e 6px 12px); border: 3px solid #f6f3ea; }
.card.dim { filter: brightness(.55); }

.table { --hh: calc(var(--ch) * 1.8); }
.handarea { position: absolute; left: 0; right: 0; bottom: 14px; height: var(--hh); z-index: 10; }
.handarea .card { position: absolute; cursor: pointer; transition: transform .12s ease, left .25s ease, top .25s ease; }
.handarea .card.sel { transform: translateY(-8px); }
.handarea .card.sel::after { content: ''; position: absolute; inset: 0; border-radius: inherit; background: rgba(70, 110, 230, .28); pointer-events: none; }
.handarea .card:hover { filter: brightness(1.03); }
.handarea .card.hint { box-shadow: 0 0 0 3px var(--accent), 0 4px 12px rgba(0,0,0,.28); }

.actionbar { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--hh) + 26px); display: flex; gap: 12px; z-index: 12; align-items: center; }
.actionbar .msg { font-size: 13px; opacity: .8; background: rgba(0,0,0,.3); border-radius: 999px; padding: 6px 14px; }
.handtools { position: absolute; right: 22px; bottom: calc(var(--hh) + 26px); z-index: 12; display: flex; gap: 6px; }
.grpline { position: absolute; bottom: -9px; height: 3px; border-radius: 3px; background: var(--accent); opacity: .8; }
.diffpick { display: grid; grid-template-columns: auto 1fr; gap: 8px 10px; align-items: center; margin-top: 18px; font-size: 12px; }
.diffpick > span { opacity: .6; }
.diffrow { display: flex; flex-wrap: wrap; gap: 4px; }
.diffrow button { border: 1px solid var(--line); background: rgba(255,255,255,.05); color: #fff; border-radius: 8px; padding: 4px 8px; font-size: 12px; cursor: pointer; font-family: inherit; }
.diffrow button:hover { background: rgba(255,255,255,.12); }
.diffrow button.cur { border-color: var(--accent); color: var(--accent); background: rgba(255,255,255,.08); }

/* ---------- 记牌器 ---------- */
.counter {
  position: absolute; top: 64px; right: 18px; z-index: 15; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 8px 10px; display: flex; gap: 2px; backdrop-filter: blur(6px);
}
.counter div { display: flex; flex-direction: column; align-items: center; width: 26px; font-family: var(--num); }
.counter div span { font-size: 11px; opacity: .6; }
.counter div b { font-size: 15px; }
.counter div b.zero { opacity: .25; }
.counter div.lv span { color: var(--accent); opacity: 1; }

/* ---------- 浮层 ---------- */
.overlay { position: absolute; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; z-index: 50; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 28px 32px; width: min(560px, 92vw);
  backdrop-filter: blur(10px); box-shadow: 0 30px 80px rgba(0,0,0,.45); max-height: 88vh; overflow: auto;
}
.modal h2 { margin: 0 0 6px; font-size: 26px; letter-spacing: .08em; }
.modal .sub { opacity: .6; font-size: 13px; margin-bottom: 18px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.result-order { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 16px 0; }
.result-order div { text-align: center; padding: 12px 6px; border-radius: 14px; background: rgba(255,255,255,.05); }
.result-order div.mine { background: rgba(217,180,91,.16); }
.result-order em { display: block; font-style: normal; font-size: 12px; opacity: .6; }
.result-order b { font-size: 16px; }
.delta { font-family: var(--num); font-weight: 700; }
.delta.up { color: #7fe0a4; } .delta.down { color: #ff8a7a; }
.kv { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.banner {
  position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); z-index: 40; pointer-events: none;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 16px 26px; text-align: center;
  backdrop-filter: blur(8px); animation: fade .25s; min-width: 280px;
}
.banner .line { font-size: 15px; margin: 6px 0; display: flex; align-items: center; justify-content: center; gap: 8px; }
.banner .card { --cw: 40px; }
.banner.big { font-size: 42px; letter-spacing: .3em; font-weight: 700; padding: 18px 40px; }

.fx { position: absolute; inset: 0; pointer-events: none; z-index: 45; display: grid; place-items: center; }
.fx .word { font-size: 96px; font-weight: 800; letter-spacing: .15em; color: #fff; text-shadow: 0 0 40px var(--red), 0 6px 0 rgba(0,0,0,.3); animation: boom .9s ease-out forwards; }
.fx .flash { position: absolute; inset: 0; background: radial-gradient(circle, rgba(255,210,120,.45), transparent 60%); animation: flash .6s ease-out forwards; }
@keyframes boom { 0% { transform: scale(2.2); opacity: 0; } 25% { transform: scale(1); opacity: 1; } 75% { opacity: 1; } 100% { transform: scale(1.1); opacity: 0; } }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }
.shake { animation: shake .45s; }
@keyframes shake { 20% { transform: translate(-6px, 3px); } 40% { transform: translate(5px, -4px); } 60% { transform: translate(-4px, 2px); } 80% { transform: translate(3px, -1px); } }

.chooser { display: flex; gap: 10px; }
.settings-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.settings-row:last-child { border-bottom: 0; }
.switch { width: 44px; height: 26px; border-radius: 999px; background: rgba(255,255,255,.2); position: relative; cursor: pointer; border: 0; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch.on { background: var(--accent); }
.switch.on::after { left: 21px; }
.themes { display: flex; gap: 8px; flex-wrap: wrap; }
.themes button { border-radius: 10px; padding: 8px 12px; border: 1px solid var(--line); background: rgba(255,255,255,.06); color: #fff; cursor: pointer; font-size: 13px; }
.themes button.cur { border-color: var(--accent); color: var(--accent); }
.themes button[disabled] { opacity: .35; cursor: default; }
input[type=range] { accent-color: var(--accent); }
.rules { font-size: 14px; line-height: 1.75; opacity: .92; }
.rules h3 { font-size: 15px; margin: 16px 0 4px; color: var(--accent); }
.rules p { margin: 4px 0; }
.ladder { display: grid; gap: 6px; margin-top: 8px; }
.ladder div { display: flex; justify-content: space-between; font-size: 13px; background: rgba(255,255,255,.04); padding: 6px 10px; border-radius: 8px; }
.toast { position: absolute; left: 50%; top: 70px; transform: translateX(-50%); background: rgba(0,0,0,.6); padding: 8px 18px; border-radius: 999px; z-index: 60; font-size: 14px; animation: fade .2s; }
.played.reveal .row .card:first-child { margin-left: 0; }

/* ---------- 手机 ---------- */
html { -webkit-tap-highlight-color: transparent; }
body { touch-action: manipulation; -webkit-touch-callout: none; overscroll-behavior: none; }
.handarea { touch-action: none; }
#rotate { display: none; }
@media (orientation: portrait) and (max-width: 760px) {
  #rotate {
    display: flex; position: fixed; inset: 0; z-index: 100; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
    background: radial-gradient(ellipse at 50% 42%, var(--bg1) 0%, var(--bg2) 78%); font-size: 18px; letter-spacing: .1em;
  }
  #rotate .phone { width: 46px; height: 76px; border: 3px solid #fff; border-radius: 9px; animation: turn 1.8s ease-in-out infinite; }
  @keyframes turn { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
}

/* 横屏手机：高度不足 520px 时整体收紧，并避开刘海与底部横条 */
@media (max-height: 520px) {
  .topbar { height: 34px; padding: 0 calc(env(safe-area-inset-right) + 10px) 0 calc(env(safe-area-inset-left) + 10px); }
  .levels { gap: 6px; }
  .lvchip { padding: 2px 8px; font-size: 11px; gap: 5px; }
  .lvchip b { font-size: 14px; }
  .handno, .rankmini { font-size: 11px; }
  .rankmini { padding: 2px 8px; }
  .tools { gap: 5px; }
  .iconbtn { width: 26px; height: 26px; }
  .iconbtn svg { width: 13px; height: 13px; }
  .center-level { font-size: 10px; letter-spacing: .2em; }
  .center-level b { font-size: 64px; }

  .seat { gap: 6px; }
  .seat.top { top: 32px; }
  .seat.left { left: calc(env(safe-area-inset-left) + 8px); top: 34%; }
  .seat.right { right: calc(env(safe-area-inset-right) + 8px); top: 34%; }
  .seat.bottom { left: calc(env(safe-area-inset-left) + 8px); bottom: calc(var(--hh) + 16px); }
  .avatar { width: 34px; height: 34px; font-size: 14px; }
  .avatar .place { font-size: 8px; bottom: -7px; padding: 0 4px; }
  .seatinfo { font-size: 10px; }
  .seatinfo .role { font-size: 9px; }
  .count { font-size: 11px; padding: 0 6px; margin-top: 2px; }

  .playzone.top { top: 78px; }
  .playzone.left { left: calc(env(safe-area-inset-left) + 62px); top: 34%; }
  .playzone.right { right: calc(env(safe-area-inset-right) + 62px); top: 34%; }
  .playzone.bottom { bottom: calc(var(--hh) + 50px); }
  .played { gap: 3px; }
  .played .tag { font-size: 9px; padding: 1px 8px; }
  .passtag { font-size: 15px; }

  .actionbar { bottom: calc(var(--hh) + 12px); gap: 8px; }
  .actionbar .msg { font-size: 11px; padding: 3px 10px; }
  .handtools { right: calc(env(safe-area-inset-right) + 8px); bottom: calc(var(--hh) + 12px); gap: 5px; }
  .btn { padding: 6px 16px; font-size: 13px; }
  .btn.small { padding: 4px 10px; font-size: 11px; }
  .handarea { bottom: calc(env(safe-area-inset-bottom) + 4px); }
  .handarea .card.sel { transform: translateY(-6px); }
  .grpline { bottom: -5px; }

  .counter { top: 38px; padding: 4px 6px; right: calc(env(safe-area-inset-right) + 10px); }
  .counter div { width: 20px; }
  .counter div b { font-size: 12px; }
  .banner { padding: 10px 18px; min-width: 200px; }
  .banner .line { font-size: 13px; }
  .banner .card { --cw: 26px; }
  .fx .word { font-size: 56px; }

  .modal { padding: 12px 18px; width: min(560px, 80vw); max-height: 92vh; border-radius: 16px; }
  .modal h2 { font-size: 18px; }
  .modal .sub { margin-bottom: 8px; font-size: 11px; }
  .modal .foot { margin-top: 10px; }
  .result-order { margin: 8px 0; gap: 6px; }
  .result-order div { padding: 5px 4px; }
  .kv { padding: 4px 0; font-size: 12px; }
  .stars { margin: 8px 0 2px; }
  .star { width: 16px; height: 16px; }

  .lobby-inner { width: min(780px, 92vw); gap: 24px; grid-template-columns: 1fr 1.15fr; }
  .brand h1 { font-size: 56px; }
  .brand p { margin: 8px 0 16px; font-size: 11px; }
  .brand .actions { gap: 8px; }
  .brand .actions .btn { min-width: 0; padding: 9px 18px; font-size: 14px; }
  .brand .links { margin-top: 12px; }
  .rankcard { padding: 14px 16px; border-radius: 16px; }
  .rank-emblem { gap: 14px; }
  .emblem { width: 48px !important; height: 48px !important; font-size: 20px !important; border-radius: 13px; }
  .rank-name { font-size: 20px; }
  .lvrow { margin-top: 8px; }
  .statgrid { gap: 6px; margin-top: 10px; }
  .statgrid div { padding: 5px 8px; border-radius: 9px; }
  .statgrid b { font-size: 15px; }
  .statgrid span { font-size: 10px; }
  .diffpick { margin-top: 10px; gap: 6px 8px; }
  .diffrow button { padding: 3px 8px; font-size: 11px; }
  .diff-note { font-size: 10px; margin-top: 8px; }
}

/* 添加到桌面引导 */
.modal.install .steps { margin: 10px 0 0; padding-left: 22px; font-size: 14px; line-height: 1.9; }
.modal.install .steps b { color: var(--accent); font-weight: 600; }
.modal.install p { margin: 6px 0; }
@media (max-height: 520px) {
  .modal.install .steps { font-size: 12px; line-height: 1.7; margin-top: 6px; }
}

/* ---------- 好友房 ---------- */
.modal.friend .fr-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; opacity: .9; margin-top: 4px; }
.modal.friend input, .fr-actions input {
  font: inherit; font-size: 15px; padding: 8px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,.2);
  background: rgba(255,255,255,.08); color: #fff; outline: none;
}
.modal.friend input:focus { border-color: var(--accent); }
.fr-actions { display: flex; align-items: center; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.fr-actions input { width: 120px; letter-spacing: .15em; }
.fr-or { opacity: .5; font-size: 12px; }

.room { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 18px calc(env(safe-area-inset-right) + 24px) 18px calc(env(safe-area-inset-left) + 24px); box-sizing: border-box; }
.room-wait { margin: auto; opacity: .7; letter-spacing: .1em; }
.room-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.room-code { font-size: 18px; letter-spacing: .1em; }
.room-code b { font-family: var(--num); font-size: 30px; color: var(--accent); letter-spacing: .12em; margin-left: 6px; }
.room-sub { font-size: 12px; opacity: .6; margin-top: 4px; }
.room-tools { display: flex; gap: 8px; }
.room-table { position: relative; flex: 1; margin: 10px auto; width: min(560px, 90%); min-height: 220px; }
.room-mid { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 120px; height: 80px; border-radius: 14px;
  background: rgba(255,255,255,.05); border: 1px solid var(--line); display: grid; place-items: center; font-family: var(--num); font-size: 20px; opacity: .7; }
.rseat { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.rseat.bottom { left: 50%; bottom: 0; transform: translateX(-50%); }
.rseat.top { left: 50%; top: 0; transform: translateX(-50%); }
.rseat.left { left: 0; top: 50%; transform: translateY(-50%); }
.rseat.right { right: 0; top: 50%; transform: translateY(-50%); }
.rseat .avatar { width: 46px; height: 46px; font-size: 18px; }
.rseat-name { font-size: 13px; font-weight: 600; }
.rseat-state, .rseat-team { font-size: 11px; opacity: .7; }
.rseat-state .ok { color: #7fe0a4; }
.rseat-state .bad, .rseat .bad { color: #ff8a7a; }
.rseat.mine .avatar { border-color: var(--accent); }
.room-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.room-mode { display: flex; gap: 6px; align-items: center; }
.room-mode button { border: 1px solid var(--line); background: rgba(255,255,255,.05); color: #fff; border-radius: 8px; padding: 5px 10px; font: inherit; font-size: 12px; cursor: pointer; }
.room-mode button.cur { border-color: var(--accent); color: var(--accent); }
.room-mode button[disabled] { cursor: default; opacity: .6; }
.room-mode button.cur[disabled] { opacity: 1; }

/* 联机：倒计时 / 托管 / 掉线 */
.olbadge { position: absolute; top: -8px; right: -10px; min-width: 18px; padding: 1px 5px; border-radius: 999px; background: #2f6f9f; color: #fff;
  font-size: 11px; font-family: var(--num); text-align: center; line-height: 16px; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.olbadge.warn { background: #c9463d; animation: pulse 1s infinite; }

@media (max-height: 520px) {
  .room { padding-top: 10px; padding-bottom: 10px; }
  .room-code b { font-size: 24px; }
  .room-table { min-height: 170px; margin: 6px auto; }
  .rseat .avatar { width: 36px; height: 36px; font-size: 15px; }
  .room-mid { width: 90px; height: 56px; font-size: 16px; }
}
