/* ==========================================================================
   麻将排行 · 样式
   主题：墨绿绒布 + 象牙牌面 + 朱红 / 描金
   ========================================================================== */

:root {
  --felt-deep: #06201a;
  --felt: #0b3227;
  --felt-soft: #124334;
  --paper: #fbf6e8;
  --paper-2: #f4ead3;
  --paper-3: #efe2c3;
  --ink: #241a12;
  --ink-soft: #6f5f4c;
  --ink-faint: #9b8b76;
  --red: #b8382a;
  --red-bright: #e05543;
  --green: #1b6f45;
  --gold: #c9a227;
  --gold-soft: #e3c46a;
  --pos: #5fe0a0;
  --neg: #ff8f7a;
  --pos-paper: #0f7a4a;
  --neg-paper: #bd3527;
  --line: rgba(36, 26, 18, 0.12);
  --line-light: rgba(255, 255, 255, 0.1);
  --shadow: 0 16px 34px rgba(0, 0, 0, 0.32);
  --serif: "Songti SC", "STSong", "SimSun", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: var(--sans);
  color: #ece5d3;
  background:
    radial-gradient(1100px 620px at 12% -12%, #17553f 0%, transparent 62%),
    radial-gradient(900px 520px at 108% 4%, #10402f 0%, transparent 58%),
    linear-gradient(168deg, #0a2e24 0%, #061e18 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

body.locked {
  overflow: hidden;
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 78%);
}

.hidden-date {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
  border: 0;
}

.muted {
  color: rgba(236, 229, 211, 0.55);
  font-size: 13px;
}

.center {
  text-align: center;
}

.pos {
  color: var(--pos);
}
.neg {
  color: var(--neg);
}
.zero {
  color: rgba(236, 229, 211, 0.5);
}

/* ---------- 顶栏 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(5, 26, 21, 0.78);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid rgba(201, 162, 39, 0.16);
}

.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  height: 62px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  gap: 22px;
}

.brand-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.mini-tile {
  width: 30px;
  height: 35px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 17px;
  color: var(--red);
  background: linear-gradient(170deg, #fffdf4, #f0e4c6);
  box-shadow: inset 0 -3px 0 rgba(160, 132, 72, 0.2), 0 3px 8px rgba(0, 0, 0, 0.35);
}

.brand-text {
  font-family: var(--serif);
  font-size: 19px;
  letter-spacing: 3px;
  font-weight: 700;
  background: linear-gradient(120deg, #f6e6b4, #d9b95c 55%, #f3e3ad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.topnav {
  display: flex;
  gap: 4px;
}

.topnav a {
  padding: 7px 14px;
  border-radius: 9px;
  font-size: 14px;
  color: rgba(236, 229, 211, 0.65);
  text-decoration: none;
  transition: 0.16s;
}

.topnav a:hover {
  color: #f4eddb;
  background: rgba(255, 255, 255, 0.06);
}

.topnav a.active {
  color: #1d1409;
  background: linear-gradient(180deg, #f7f0dd, #e6d7b4);
  font-weight: 600;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 12px 5px 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: inherit;
  cursor: pointer;
  transition: 0.16s;
}

.user-chip:hover {
  background: rgba(255, 255, 255, 0.12);
}

.user-name {
  font-size: 14px;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-tag {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 6px;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.role-super {
  background: rgba(201, 162, 39, 0.2);
  color: var(--gold-soft);
  border: 1px solid rgba(201, 162, 39, 0.4);
}

.role-admin {
  background: rgba(95, 224, 160, 0.14);
  color: var(--pos);
  border: 1px solid rgba(95, 224, 160, 0.28);
}

.role-member {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(236, 229, 211, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(236, 229, 211, 0.75);
  cursor: pointer;
  font-size: 15px;
  display: grid;
  place-items: center;
  transition: 0.16s;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* ---------- 页面骨架 ---------- */

.view {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: 30px 22px 90px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

.page-title {
  font-family: var(--serif);
  font-size: 30px;
  margin: 0 0 6px;
  letter-spacing: 2px;
  background: linear-gradient(120deg, #fbf3dd, #dcbf72);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.page-sub {
  margin: 0;
  font-size: 14px;
  color: rgba(236, 229, 211, 0.6);
}

.page-actions {
  display: flex;
  gap: 10px;
}

/* ---------- 按钮 ---------- */

.btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  border-radius: 11px;
  padding: 10px 18px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.16s, background 0.16s;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px) scale(0.99);
}

.btn.primary {
  background: linear-gradient(180deg, #2c7457, #1b5540);
  color: #f6f0df;
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.btn.primary:hover {
  background: linear-gradient(180deg, #358a66, #1f6249);
}

.btn.danger {
  background: linear-gradient(180deg, #c04434, #9d2f22);
  color: #fff3ee;
  border-color: rgba(255, 255, 255, 0.14);
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(236, 229, 211, 0.85);
  border-color: rgba(255, 255, 255, 0.16);
}

.btn.ghost:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn.block {
  width: 100%;
}

.btn.lg {
  padding: 14px 20px;
  font-size: 15px;
}

.btn.sm {
  padding: 7px 13px;
  font-size: 13px;
  border-radius: 9px;
}

.btn.xs {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 8px;
}

.btn.danger-text {
  color: var(--neg-paper);
}

/* 象牙卡片内的 ghost 按钮换成深色系 */
.sheet .btn.ghost,
.table-wrap .btn.ghost,
.login-card .btn.ghost {
  color: var(--ink);
  border-color: rgba(36, 26, 18, 0.16);
  background: rgba(36, 26, 18, 0.04);
}

.sheet .btn.ghost:hover,
.table-wrap .btn.ghost:hover {
  background: rgba(36, 26, 18, 0.09);
}

/* ---------- 牌面头像 ---------- */

.tile {
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(170deg, #fffdf4 0%, #f7eed8 58%, #efe1c0 100%);
  border: 1px solid #e5d6b2;
  box-shadow: inset 0 -4px 0 rgba(160, 132, 72, 0.16), 0 4px 11px rgba(0, 0, 0, 0.3);
  font-family: var(--serif);
  font-weight: 700;
  color: var(--red);
  padding: 0;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  flex: none;
}

.tile:hover {
  transform: translateY(-2px) rotate(-1.5deg);
  box-shadow: inset 0 -4px 0 rgba(160, 132, 72, 0.16), 0 8px 16px rgba(0, 0, 0, 0.35);
}

.tile:active {
  transform: translateY(0) scale(0.97);
}

.tile-xs {
  width: 26px;
  height: 30px;
  font-size: 14px;
  border-radius: 7px;
  box-shadow: inset 0 -2px 0 rgba(160, 132, 72, 0.16), 0 2px 5px rgba(0, 0, 0, 0.25);
}

.tile-sm {
  width: 34px;
  height: 40px;
  font-size: 18px;
  border-radius: 8px;
}

.tile-md {
  width: 44px;
  height: 52px;
  font-size: 23px;
}

.tile-xl {
  width: 74px;
  height: 88px;
  font-size: 40px;
  border-radius: 14px;
}

/* ---------- 登录 ---------- */

.login-wrap {
  min-height: calc(100vh - 170px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(180deg, #fdf9ee, #f4ead3);
  border-radius: 22px;
  padding: 32px 28px 28px;
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: var(--shadow), inset 0 1px 0 #fff;
}

.login-brand {
  text-align: center;
  margin-bottom: 24px;
}

.big-tile {
  width: 78px;
  height: 92px;
  margin: 0 auto 14px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 44px;
  font-weight: 700;
  color: var(--red);
  background: linear-gradient(170deg, #fffdf5, #f2e7cb);
  border: 1px solid #e8dab6;
  box-shadow: inset 0 -6px 0 rgba(160, 132, 72, 0.16), 0 10px 22px rgba(120, 90, 30, 0.22);
}

.login-brand h1 {
  font-family: var(--serif);
  font-size: 27px;
  letter-spacing: 6px;
  margin: 0 0 6px;
  color: #2c1e12;
}

.login-brand p {
  margin: 0;
  font-size: 13px;
  color: var(--ink-soft);
  letter-spacing: 1px;
}

.login-tabs {
  margin: 0 auto 20px;
  background: rgba(36, 26, 18, 0.06);
  border-color: rgba(36, 26, 18, 0.08);
}

.login-tabs .tab {
  color: rgba(36, 26, 18, 0.55);
}

.login-tabs .tab.active {
  background: #fffdf6;
  color: #2c1e12;
  box-shadow: 0 3px 9px rgba(120, 90, 30, 0.18);
}

.login-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hint {
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--ink-soft);
  margin: 0;
}

.device-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 11px;
  background: rgba(36, 26, 18, 0.05);
  border: 1px dashed rgba(36, 26, 18, 0.18);
}

.device-box code {
  font-size: 12px;
  color: var(--ink-soft);
  letter-spacing: 0.4px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field > span {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.5px;
}

.field input,
.field select {
  font-family: inherit;
  font-size: 15px;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid rgba(36, 26, 18, 0.16);
  background: #fffdf7;
  color: var(--ink);
  outline: none;
  transition: 0.16s;
}

.field input:focus,
.field select:focus {
  border-color: rgba(27, 111, 69, 0.6);
  box-shadow: 0 0 0 3px rgba(27, 111, 69, 0.12);
}

.code-input {
  text-align: center;
  letter-spacing: 8px;
  font-size: 20px !important;
  font-weight: 700;
  text-transform: uppercase;
}

.login-foot {
  font-size: 12px;
  color: rgba(236, 229, 211, 0.35);
  letter-spacing: 1px;
}

/* ---------- 标签页 ---------- */

.tabs {
  display: flex;
  gap: 4px;
  padding: 5px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  width: fit-content;
}

.tab {
  padding: 8px 16px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: rgba(236, 229, 211, 0.62);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.16s;
  white-space: nowrap;
}

.tab:hover {
  color: #f4eddb;
}

.tab.active {
  background: linear-gradient(180deg, #f8f1de, #e7d8b5);
  color: #241a12;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28);
}

/* ---------- 房间卡片 ---------- */

.room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 16px;
}

.room-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  padding: 18px;
  cursor: pointer;
  transition: 0.18s;
  position: relative;
  overflow: hidden;
}

.room-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(201, 162, 39, 0.6), transparent);
  opacity: 0;
  transition: 0.2s;
}

.room-card:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.06));
  border-color: rgba(201, 162, 39, 0.3);
  transform: translateY(-2px);
}

.room-card:hover::before {
  opacity: 1;
}

.room-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.room-card h3 {
  font-family: var(--serif);
  font-size: 19px;
  margin: 0;
  letter-spacing: 1.5px;
  color: #f7f0dd;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code-chip {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  letter-spacing: 1.6px;
  padding: 4px 9px;
  border-radius: 7px;
  background: rgba(201, 162, 39, 0.12);
  border: 1px solid rgba(201, 162, 39, 0.28);
  color: var(--gold-soft);
  flex: none;
}

.room-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.stat-pill {
  font-size: 12.5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(236, 229, 211, 0.8);
}

.room-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px dashed rgba(255, 255, 255, 0.09);
}

.tag-gold {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(201, 162, 39, 0.16);
  border: 1px solid rgba(201, 162, 39, 0.35);
  color: var(--gold-soft);
  white-space: nowrap;
}

.tag-gold.sm {
  font-size: 10px;
  padding: 1px 6px;
}

.tag-me {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(184, 56, 42, 0.12);
  border: 1px solid rgba(184, 56, 42, 0.3);
  color: var(--red);
  white-space: nowrap;
}

/* ---------- 空状态 ---------- */

.empty {
  text-align: center;
  padding: 60px 24px;
  border-radius: 20px;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.025);
}

.empty-tile {
  width: 62px;
  height: 74px;
  margin: 0 auto 18px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 34px;
  color: var(--red);
  background: linear-gradient(170deg, #fffdf4, #eee0bd);
  box-shadow: inset 0 -5px 0 rgba(160, 132, 72, 0.16), 0 8px 18px rgba(0, 0, 0, 0.3);
  opacity: 0.9;
}

.empty h3 {
  font-family: var(--serif);
  font-size: 20px;
  margin: 0 0 8px;
  letter-spacing: 1.5px;
  color: #f2ead6;
}

.empty p {
  margin: 0 0 20px;
  color: rgba(236, 229, 211, 0.5);
  font-size: 13.5px;
}

/* ---------- 房间头 ---------- */

.room-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.back-link {
  display: inline-block;
  font-size: 12.5px;
  color: rgba(236, 229, 211, 0.45);
  text-decoration: none;
  margin-bottom: 8px;
  letter-spacing: 1px;
}

.back-link:hover {
  color: var(--gold-soft);
}

.room-title {
  font-family: var(--serif);
  font-size: 31px;
  margin: 0 0 12px;
  letter-spacing: 2px;
  background: linear-gradient(120deg, #fdf6e2, #dcbf72 70%, #f5e7bb);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.room-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.chip-btn {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  letter-spacing: 1px;
  padding: 5px 11px;
  border-radius: 8px;
  background: rgba(201, 162, 39, 0.12);
  border: 1px solid rgba(201, 162, 39, 0.3);
  color: var(--gold-soft);
  cursor: pointer;
  transition: 0.16s;
}

.chip-btn:hover {
  background: rgba(201, 162, 39, 0.22);
}

.chip-static {
  font-size: 12px;
  padding: 5px 11px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(236, 229, 211, 0.72);
}

.room-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.room-tabs {
  margin-bottom: 20px;
}

.tab-body {
  min-height: 200px;
}

/* ---------- 牌桌 ---------- */

.table-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 11px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 18px;
  font-size: 13px;
  color: rgba(236, 229, 211, 0.7);
}

.table-bar-left {
  display: flex;
  align-items: center;
  gap: 9px;
}

.dot-live {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.5);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(74, 222, 128, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0);
  }
}

.player-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(222px, 1fr));
  gap: 14px;
}

.player-card {
  position: relative;
  background: linear-gradient(180deg, #fdf9ee 0%, #f4ead3 100%);
  border-radius: 18px;
  padding: 14px 14px 12px;
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.28), inset 0 1px 0 #fff;
  transition: 0.18s;
}

.player-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.34), inset 0 1px 0 #fff;
}

.player-card.is-me {
  border-color: rgba(201, 162, 39, 0.85);
  box-shadow: 0 0 0 2px rgba(201, 162, 39, 0.35), 0 14px 28px rgba(0, 0, 0, 0.28);
}

.pc-head {
  display: flex;
  align-items: center;
  gap: 11px;
}

.pc-id {
  min-width: 0;
  flex: 1;
}

.pc-name {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  color: #2a1d12;
  line-height: 1.3;
}

.pc-sub {
  font-size: 11.5px;
  color: var(--ink-faint);
  margin-top: 3px;
}

.pc-score {
  font-size: 42px;
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -1.5px;
  font-variant-numeric: tabular-nums;
  margin: 8px 0 2px;
  display: inline-block;
}

.player-card .pos {
  color: var(--pos-paper);
}
.player-card .neg {
  color: var(--neg-paper);
}
.player-card .zero {
  color: #a2907a;
}

.pc-score.bump {
  animation: bump 0.42s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes bump {
  0% {
    transform: scale(1);
  }
  38% {
    transform: scale(1.16);
  }
  100% {
    transform: scale(1);
  }
}

.fly {
  position: absolute;
  right: 20px;
  top: 62px;
  font-weight: 800;
  font-size: 19px;
  pointer-events: none;
  animation: fly 0.9s ease forwards;
}

@keyframes fly {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.9);
  }
  22% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-30px) scale(1.05);
  }
}

.pc-meta {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 11px;
  flex-wrap: wrap;
}

.pc-meta b {
  font-variant-numeric: tabular-nums;
}

.pc-actions {
  display: flex;
  gap: 7px;
  margin-bottom: 8px;
}

.btn-delta {
  flex: 1;
  height: 40px;
  border-radius: 11px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  border: 1px solid transparent;
  transition: 0.13s;
  font-variant-numeric: tabular-nums;
}

.btn-delta:active {
  transform: scale(0.96);
}

.btn-delta.minus {
  background: #fdecea;
  color: var(--neg-paper);
  border-color: #f4d2cd;
}

.btn-delta.minus:hover {
  background: #fbdcd7;
}

.btn-delta.plus {
  background: #e6f5eb;
  color: var(--pos-paper);
  border-color: #c8e6d5;
}

.btn-delta.plus:hover {
  background: #d6efe0;
}

.btn-delta.more {
  flex: 0 0 46px;
  background: rgba(36, 26, 18, 0.05);
  color: var(--ink-soft);
  border-color: rgba(36, 26, 18, 0.1);
  font-size: 18px;
  letter-spacing: 1px;
}

.btn-delta.more:hover {
  background: rgba(36, 26, 18, 0.1);
}

.pc-mistakes {
  display: flex;
  gap: 7px;
}

.mini {
  flex: 1;
  height: 30px;
  border-radius: 9px;
  background: rgba(36, 26, 18, 0.04);
  border: 1px dashed rgba(36, 26, 18, 0.16);
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 11.5px;
  cursor: pointer;
  transition: 0.15s;
}

.mini b {
  font-variant-numeric: tabular-nums;
  margin-left: 3px;
}

.mini:hover {
  background: rgba(36, 26, 18, 0.08);
}

.mini.has {
  background: #fdf2dd;
  border-style: solid;
  border-color: #ecd39f;
  color: #8a6114;
}

.tip {
  margin: 18px 0 0;
  font-size: 12px;
  color: rgba(236, 229, 211, 0.35);
  text-align: center;
  letter-spacing: 0.4px;
}

/* ---------- 榜单 ---------- */

.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.date-btn {
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  padding: 8px 15px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #f0e8d5;
  cursor: pointer;
  transition: 0.16s;
}

.date-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(201, 162, 39, 0.4);
}

.rank-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rank-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: 0.16s;
}

.rank-row:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.16);
}

.rank-row.is-me {
  border-color: rgba(201, 162, 39, 0.55);
  background: rgba(201, 162, 39, 0.09);
}

.rank-no {
  width: 30px;
  height: 30px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 800;
  color: rgba(236, 229, 211, 0.45);
  font-variant-numeric: tabular-nums;
}

.rank-no.top {
  border-radius: 50%;
  color: #2f2107;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.16), 0 3px 9px rgba(0, 0, 0, 0.3);
}

.rank-no.r1 {
  background: linear-gradient(180deg, #fbe9ab, #d9b437);
}

.rank-no.r2 {
  background: linear-gradient(180deg, #f3f4f7, #b7bcc6);
  color: #33363c;
}

.rank-no.r3 {
  background: linear-gradient(180deg, #f3cda3, #bc7f4e);
  color: #43260f;
}

/* 徽章（个人浮窗里复用同一套配色） */
.m1 {
  background: linear-gradient(180deg, #fbe9ab, #d9b437);
}
.m2 {
  background: linear-gradient(180deg, #f3f4f7, #b7bcc6);
  color: #33363c;
}
.m3 {
  background: linear-gradient(180deg, #f3cda3, #bc7f4e);
  color: #43260f;
}

.medal-badge {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 800;
  color: #2f2107;
  margin-right: 3px;
  vertical-align: -3px;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.18);
}

.medal-big {
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 800;
  color: #2f2107;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.16), 0 6px 14px rgba(0, 0, 0, 0.24);
}

.self-bar .btn {
  flex: none;
}

.self-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -2px 0 16px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(36, 26, 18, 0.04);
  border: 1px dashed rgba(36, 26, 18, 0.14);
}

.rank-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14.5px;
  font-weight: 600;
  color: #f4eddb;
  min-width: 0;
  flex-wrap: wrap;
}

.rank-bar {
  flex: 1;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
  min-width: 40px;
}

.rank-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(95, 224, 160, 0.35), rgba(95, 224, 160, 0.85));
  transition: width 0.4s ease;
}

.rank-bar i.neg {
  background: linear-gradient(90deg, rgba(255, 143, 122, 0.35), rgba(255, 143, 122, 0.85));
}

.rank-bar i.zero {
  background: rgba(255, 255, 255, 0.18);
}

.rank-score {
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  min-width: 66px;
  text-align: right;
  flex: none;
}

.badge-top {
  font-size: 10.5px;
  padding: 1px 7px;
  border-radius: 6px;
  background: rgba(201, 162, 39, 0.16);
  border: 1px solid rgba(201, 162, 39, 0.4);
  color: var(--gold-soft);
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.badge-top.strong {
  background: linear-gradient(180deg, #f5e2ab, #dcbf72);
  color: #4a3410;
  border-color: #c9a227;
  font-weight: 700;
}

/* ---------- 历史桌次 ---------- */

.history-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.history-card {
  background: linear-gradient(180deg, #fdf9ee, #f3e9d1);
  border-radius: 16px;
  padding: 15px 16px;
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.22);
}

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px dashed rgba(36, 26, 18, 0.14);
  margin-bottom: 10px;
}

.history-head b {
  font-family: var(--serif);
  font-size: 16px;
  letter-spacing: 1px;
  color: #2a1d12;
}

.history-head .muted {
  color: var(--ink-faint);
  margin-left: 8px;
  font-size: 11.5px;
}

.winner-tag {
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #fdf2dd;
  border: 1px solid #ecd39f;
  color: #8a6114;
  white-space: nowrap;
}

.history-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.history-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 0;
  font-size: 13px;
}

.history-row.is-winner {
  font-weight: 700;
}

.history-name {
  flex: 1;
  color: #2a1d12;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-card .pos {
  color: var(--pos-paper);
}
.history-card .neg {
  color: var(--neg-paper);
}
.history-card .zero {
  color: #a2907a;
}

.history-card .rank-score {
  font-size: 14px;
  min-width: 52px;
}

/* ---------- 弹窗 ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(3, 14, 11, 0.62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.18s ease;
  overflow-y: auto;
}

#modal-root.open .modal-backdrop {
  opacity: 1;
}

.sheet {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(180deg, #fdf9ee, #f3e9d1);
  border-radius: 22px;
  padding: 22px;
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.5), inset 0 1px 0 #fff;
  transform: translateY(16px) scale(0.97);
  transition: transform 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  position: relative;
  margin: auto;
}

#modal-root.open .sheet {
  transform: translateY(0) scale(1);
  /* 插入即播放，不依赖 rAF（后台标签页会被节流） */
  animation: sheetIn 0.24s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes sheetIn {
  0% {
    opacity: 0;
    transform: translateY(16px) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.sheet.wide {
  max-width: 480px;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.sheet-head h3 {
  font-family: var(--serif);
  font-size: 19px;
  margin: 0;
  letter-spacing: 1.5px;
  color: #2a1d12;
}

.sheet-head .icon-btn,
.sheet-close {
  position: static;
  color: var(--ink-soft);
  border-color: rgba(36, 26, 18, 0.12);
  background: rgba(36, 26, 18, 0.04);
}

.sheet-head .icon-btn:hover,
.sheet-close:hover {
  background: rgba(36, 26, 18, 0.09);
  color: var(--ink);
}

.sheet-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
}

.sheet-text {
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--ink-soft);
  margin: 0 0 20px;
}

.sheet-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.seg {
  display: flex;
  gap: 6px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(36, 26, 18, 0.05);
  border: 1px solid rgba(36, 26, 18, 0.1);
}

.seg-btn {
  flex: 1;
  padding: 9px 10px;
  border-radius: 9px;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  transition: 0.15s;
  white-space: nowrap;
}

.seg-btn:hover {
  background: rgba(36, 26, 18, 0.05);
}

.seg-btn.active {
  background: #fffdf6;
  color: #2c1e12;
  box-shadow: 0 3px 9px rgba(120, 90, 30, 0.16);
}

.quick-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.quick-chip {
  padding: 8px 0;
  border-radius: 9px;
  border: 1px solid rgba(36, 26, 18, 0.12);
  background: rgba(36, 26, 18, 0.03);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-soft);
  cursor: pointer;
  transition: 0.15s;
}

.quick-chip:hover {
  background: rgba(36, 26, 18, 0.09);
  color: var(--ink);
}

/* ---------- 个人档案 ---------- */

.profile-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-right: 40px;
  padding-bottom: 18px;
  border-bottom: 1px dashed rgba(36, 26, 18, 0.14);
  margin-bottom: 16px;
}

.profile-id {
  flex: 1;
  min-width: 0;
}

.profile-id h2 {
  font-family: var(--serif);
  font-size: 24px;
  margin: 0 0 7px;
  letter-spacing: 1.5px;
  color: #2a1d12;
}

.profile-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
}

.profile-sub .muted {
  color: var(--ink-faint);
}

.medal-big {
  font-size: 34px;
  line-height: 1;
  filter: drop-shadow(0 3px 6px rgba(120, 90, 30, 0.3));
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.stat {
  background: rgba(36, 26, 18, 0.04);
  border: 1px solid rgba(36, 26, 18, 0.07);
  border-radius: 12px;
  padding: 10px 6px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat span {
  font-size: 10.5px;
  color: var(--ink-faint);
  letter-spacing: 0.4px;
}

.stat b {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  color: #2a1d12;
}

.stat b small {
  font-size: 10px;
  font-weight: 500;
  color: var(--ink-faint);
}

.sheet .muted {
  color: var(--ink-faint);
}

.sheet .pos {
  color: var(--pos-paper);
}
.sheet .neg {
  color: var(--neg-paper);
}
.sheet .zero {
  color: #a2907a;
}

.sub-title {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--ink-soft);
  margin: 0 0 9px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sub-title small {
  font-weight: 400;
  letter-spacing: 0;
}

.fault-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
}

.fault {
  background: #fdf1e2;
  border: 1px solid #eed9b8;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  align-items: baseline;
  gap: 9px;
}

.fault b {
  font-size: 22px;
  color: var(--red);
  font-variant-numeric: tabular-nums;
}

.fault span {
  font-size: 11.5px;
  color: #8a6a44;
}

.date-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.date-chip {
  font-size: 11.5px;
  padding: 4px 9px;
  border-radius: 7px;
  background: rgba(36, 26, 18, 0.05);
  border: 1px solid rgba(36, 26, 18, 0.08);
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

/* ---------- 管理台 ---------- */

.overview-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.ov {
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 13px;
  padding: 13px 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ov b {
  font-size: 22px;
  font-weight: 800;
  color: var(--gold-soft);
  font-variant-numeric: tabular-nums;
}

.ov span {
  font-size: 11px;
  color: rgba(236, 229, 211, 0.5);
  letter-spacing: 0.6px;
}

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.admin-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-name {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: #f2ead6;
  display: flex;
  align-items: baseline;
  gap: 9px;
  min-width: 0;
}

.admin-name small {
  color: rgba(236, 229, 211, 0.45);
  font-weight: 400;
  font-size: 11.5px;
}

.score-input {
  width: 92px;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.2);
  color: #f7f0dd;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
  outline: none;
  transition: 0.15s;
}

.score-input:focus {
  border-color: rgba(201, 162, 39, 0.6);
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.14);
}

.save-bar {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}

.table-wrap {
  background: linear-gradient(180deg, #fdf9ee, #f4ead3);
  border-radius: 16px;
  padding: 6px;
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.24);
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table th {
  text-align: left;
  font-size: 11.5px;
  letter-spacing: 1px;
  color: var(--ink-faint);
  font-weight: 700;
  padding: 11px 13px;
  border-bottom: 1px solid rgba(36, 26, 18, 0.1);
  white-space: nowrap;
}

.data-table td {
  padding: 10px 13px;
  border-bottom: 1px solid rgba(36, 26, 18, 0.06);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table code {
  font-size: 12px;
  letter-spacing: 1.2px;
  color: #8a6114;
  background: rgba(201, 162, 39, 0.12);
  padding: 3px 7px;
  border-radius: 6px;
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.mini-select {
  font-family: inherit;
  font-size: 12.5px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(36, 26, 18, 0.14);
  background: #fffdf7;
  color: var(--ink);
  max-width: 130px;
  outline: none;
}

.member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 9px;
}

.member-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.member-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.member-info b {
  font-size: 14px;
  color: #f4eddb;
}

.member-info small {
  color: rgba(236, 229, 211, 0.45);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translate(-50%, 20px);
  z-index: 200;
  padding: 11px 20px;
  border-radius: 12px;
  background: linear-gradient(180deg, #fdf9ee, #f2e7cd);
  color: #2a1d12;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: 0.24s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  max-width: min(90vw, 420px);
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.err {
  background: linear-gradient(180deg, #fdeceb, #f7d9d4);
  color: #8f2618;
}

/* ---------- 响应式 ---------- */

@media (max-width: 860px) {
  .overview-strip {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 720px) {
  .view {
    padding: 20px 14px 80px;
  }

  .topbar-inner {
    padding: 0 14px;
    gap: 12px;
    height: 56px;
  }

  .brand-text {
    font-size: 16px;
    letter-spacing: 2px;
  }

  .topnav {
    display: none;
  }

  .page-title {
    font-size: 24px;
  }

  .room-title {
    font-size: 25px;
  }

  .page-head {
    margin-bottom: 18px;
  }

  .page-actions {
    width: 100%;
  }

  .page-actions .btn {
    flex: 1;
  }

  .player-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .player-card {
    padding: 11px 11px 10px;
    border-radius: 15px;
  }

  .pc-score {
    font-size: 34px;
  }

  .pc-name {
    font-size: 13.5px;
  }

  .btn-delta {
    height: 44px;
    font-size: 17px;
  }

  .pc-meta {
    gap: 9px;
    font-size: 11px;
  }

  .player-card .tile-md {
    width: 38px;
    height: 45px;
    font-size: 20px;
  }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .room-actions {
    width: 100%;
  }

  .room-actions .btn {
    flex: 1;
  }

  .room-tabs {
    width: 100%;
    overflow-x: auto;
  }

  .room-tabs .tab {
    flex: 1;
    padding: 8px 10px;
    font-size: 13px;
  }

  .rank-row {
    gap: 9px;
    padding: 9px 11px;
  }

  .rank-score {
    min-width: 52px;
    font-size: 16px;
  }

  .rank-bar {
    display: none;
  }

  .history-list {
    grid-template-columns: 1fr;
  }

  .login-card {
    padding: 26px 20px 22px;
  }

  .member-grid {
    grid-template-columns: 1fr;
  }

  .admin-name {
    font-size: 13px;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
  }

  .score-input {
    width: 74px;
  }

  .sheet {
    padding: 18px;
    border-radius: 18px;
  }

  .quick-row {
    grid-template-columns: repeat(3, 1fr);
  }

  .overview-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .data-table {
    font-size: 12.5px;
  }

  .data-table th,
  .data-table td {
    padding: 8px 9px;
  }
}

@media (max-width: 380px) {
  .player-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
