/* 摸鱼 UNO — 贴近官方红黄牌面风格 */
:root {
  --bg: #1a0a0a;
  --bg2: #2a1010;
  --ink: #fff8f0;
  --muted: #c9a8a8;
  --accent: #ffd200;
  --danger: #e60000;
  --card-w: 58px;
  --card-h: 88px;
  --red: #e10600;
  --yellow: #ffcd00;
  --green: #00a651;
  --blue: #0072ce;
  --uno-black: #111;
  --font: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --display: "ZCOOL KuaiLe", "Noto Sans SC", sans-serif;
  --pad: max(0.75rem, env(safe-area-inset-left));
  --pad-r: max(0.75rem, env(safe-area-inset-right));
  --pad-b: max(0.75rem, env(safe-area-inset-bottom));
  --radius: 16px;
  --touch: 44px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(ellipse at 50% -20%, #ff3b3b 0%, transparent 50%),
    radial-gradient(ellipse at 100% 80%, #4a1500 0%, transparent 45%),
    linear-gradient(180deg, #1a0505, #0d0202 70%);
  min-height: 100dvh;
  overscroll-behavior: none;
}

#app {
  width: min(100%, 980px);
  margin: 0 auto;
  min-height: 100dvh;
  position: relative;
  z-index: 1;
}
.screen { padding: 0.85rem var(--pad) var(--pad-b) var(--pad-r); }
.screen[hidden], [hidden] { display: none !important; }
.screen.screen-enter {
  animation: screenIn 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes screenIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.brand {
  font-family: var(--display);
  font-size: 0.9rem;
  letter-spacing: 0.16em;
  color: var(--accent);
  margin: 0 0 0.35rem;
}
.uno-logo {
  display: inline-block;
  margin: 0.2rem 0 0.55rem;
  font-family: Impact, "Arial Black", "Helvetica Neue", sans-serif;
  font-size: clamp(2.6rem, 14vw, 3.6rem);
  font-weight: 900;
  letter-spacing: 0.02em;
  color: var(--accent);
  transform: rotate(-8deg);
  line-height: 0.9;
  -webkit-text-stroke: 5px #111;
  paint-order: stroke fill;
  text-shadow:
    3px 3px 0 #fff,
    -1px -1px 0 #111,
    0 6px 0 rgba(0,0,0,0.35);
}
.uno-logo span { color: var(--accent); }
.uno-hero {
  position: relative;
  text-align: center;
  padding: 1.1rem 1rem 1rem;
  margin: 0 0 0.85rem;
  border-radius: 18px;
  overflow: hidden;
  border: 3px solid #fff;
  box-shadow: 0 10px 28px rgba(0,0,0,0.35), inset 0 0 0 2px rgba(0,0,0,0.2);
  background:
    repeating-conic-gradient(from 8deg at 50% 50%, #ff1a1a 0 10deg, #c40000 10deg 20deg);
}
.uno-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 40%, transparent 20%, rgba(0,0,0,0.28) 100%);
  pointer-events: none;
}
.uno-hero > * { position: relative; z-index: 1; }
.uno-hero .sub { color: #ffe8e8; margin: 0; text-shadow: 0 1px 2px #000; }
.uno-hero-img {
  width: min(120px, 36vw);
  height: auto;
  margin: 0 auto 0.35rem;
  display: block;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,0.45));
}
.hero h1, .panel h2, .auth-box h3 {
  font-family: var(--display);
  margin: 0 0 0.45rem;
  font-weight: 400;
  font-size: clamp(1.55rem, 5.5vw, 2.15rem);
  line-height: 1.2;
}
.sub { color: var(--muted); margin: 0 0 0.75rem; line-height: 1.5; font-size: 0.88rem; }
.sub.tight { margin-bottom: 0.75rem; font-size: 0.88rem; }
.foot { color: var(--muted); font-size: 0.75rem; margin-top: 0.85rem; line-height: 1.45; }
.muted { color: var(--muted); font-size: 0.85rem; }
.label { color: var(--muted); font-size: 0.85rem; margin: 0.5rem 0 0.35rem; }

/* —— 大厅：手机顶对齐，桌面垂直居中 —— */
.lobby-screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.lobby-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-shrink: 0;
}
.head-auth {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.oauth-mini {
  border: none;
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  min-height: var(--touch);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
  box-shadow: 0 2px 0 rgba(0,0,0,0.25);
}
.oauth-mini.wx { background: #07c160; }
.oauth-mini.qq { background: #12b7f5; }
.oauth-mini:disabled { opacity: 0.45; cursor: not-allowed; }
.lobby-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  max-width: 400px;
  width: 100%;
  margin: 0 auto;
  padding-bottom: 0.75rem;
}

.back, .ghost {
  background: #111;
  color: #fff;
  border: 2px solid #fff;
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  min-height: var(--touch);
  font-size: 0.85rem;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  box-shadow: 0 2px 0 #c40000;
}
.ghost.block { display: flex; width: 100%; margin-top: 0.6rem; }

.me-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  align-self: flex-start;
  background: #111;
  border: 3px solid #fff;
  border-radius: 999px;
  padding: 0.35rem 0.75rem 0.35rem 0.4rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 3px 0 #111, 0 6px 14px rgba(0,0,0,0.3);
}
.me-chip .av { font-size: 1.25rem; line-height: 1; }
.av-img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  display: inline-block;
  vertical-align: middle;
  background: rgba(0,0,0,0.2);
  flex-shrink: 0;
}
.me-chip .av-img { width: 32px; height: 32px; }
.opp .av-img { width: 28px; height: 28px; }
.sv-side .av-img { width: 22px; height: 22px; }
.seats .av-img { width: 24px; height: 24px; }
.end-av .av-img, #endAvA .av-img, #endAvB .av-img { width: 48px; height: 48px; }
.me-chip .tag {
  font-size: 0.68rem;
  color: #111;
  background: var(--accent);
  border-radius: 999px;
  padding: 0.12rem 0.45rem;
  font-weight: 800;
  border: 1px solid #111;
}

.panel {
  background: rgba(20,8,8,0.88);
  border: 3px solid #fff;
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: 0 4px 0 #111, 0 14px 36px rgba(0,0,0,0.35);
}
label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.85rem; }
input {
  display: block;
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.8rem 0.9rem;
  border-radius: 12px;
  border: 2px solid #fff;
  background: #111;
  color: var(--ink);
  font-size: 16px; /* 防 iOS 缩放 */
  box-shadow: inset 0 0 0 1px #111;
}
input::placeholder { color: #9a7a7a; }
input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255,210,0,0.35);
}
.row { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; }
.row.join input { flex: 1; margin: 0; min-width: 0; }
.row.join button {
  flex-shrink: 0;
  background: #111;
  border: 2px solid #fff;
  color: #fff;
  font-weight: 800;
  box-shadow: 0 2px 0 #c40000;
  min-width: 4.5rem;
}
.or {
  text-align: center;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  margin: 0.55rem 0;
  letter-spacing: 0.08em;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  min-height: var(--touch);
  font-size: 1rem;
  font-family: inherit;
  background: rgba(255,255,255,0.12);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
button.primary {
  width: 100%;
  background: linear-gradient(180deg, #ffe44d, var(--accent) 55%, #e6b800);
  color: #111;
  font-weight: 900;
  letter-spacing: 0.04em;
  border: 2px solid #111;
  box-shadow: 0 4px 0 #111, 0 8px 18px rgba(0,0,0,0.28);
}
button.primary:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #111, 0 4px 10px rgba(0,0,0,0.25);
}
button:disabled { opacity: 0.45; cursor: not-allowed; }
button:active:not(:disabled) { transform: scale(0.98); }
@media (hover: hover) {
  button:hover:not(:disabled) { filter: brightness(1.06); }
}

.err { color: #ffb4a8; font-size: 0.9rem; margin-top: 0.75rem; }
.err.toast {
  position: fixed;
  left: 50%;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: #c40000;
  color: #fff;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: 2px solid #fff;
  box-shadow: 0 3px 0 #111;
  z-index: 40;
  margin: 0;
  max-width: min(92vw, 360px);
  text-align: center;
  font-weight: 800;
}

.code { color: var(--accent); letter-spacing: 0.12em; }
.share { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.share input { margin: 0; flex: 1; min-width: 0; font-size: 13px; }
.share button {
  flex-shrink: 0;
  background: #111;
  border: 2px solid #fff;
  color: #fff;
  font-weight: 800;
  box-shadow: 0 2px 0 #c40000;
  min-height: 44px;
  padding: 0.5rem 0.75rem;
}
.share-native {
  background: linear-gradient(180deg, #ffe44d, var(--accent));
  color: #111;
  font-weight: 800;
  border: 2px solid #111;
  box-shadow: 0 2px 0 #111;
}
.share-actions {
  display: flex;
  gap: 0.45rem;
  margin: -0.45rem 0 0.85rem;
  flex-wrap: wrap;
}
.ghost.mini {
  min-height: 36px;
  padding: 0.3rem 0.7rem;
  font-size: 0.78rem;
  box-shadow: none;
}
.friends-panel { margin: 0 0 0.85rem; }
.friends-label {
  margin: 0 0 0.4rem;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 700;
}
.friends-row {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  padding-bottom: 0.2rem;
  -webkit-overflow-scrolling: touch;
}
.friend-chip {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  width: 64px;
  background: rgba(0,0,0,0.28);
  border: 2px solid rgba(255,255,255,0.35);
  border-radius: 12px;
  padding: 0.4rem 0.25rem;
  color: #fff;
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 700;
}
.friend-chip .av-img, .friend-chip .av {
  width: 36px;
  height: 36px;
  font-size: 1.2rem;
  line-height: 36px;
  text-align: center;
}
.friend-chip .fn {
  max-width: 58px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.share-box { text-align: center; max-width: 400px; }
.share-box .close {
  position: absolute;
  right: 0.45rem;
  top: 0.35rem;
  background: transparent;
  font-size: 1.45rem;
  color: var(--muted);
  border: none;
  width: var(--touch);
  height: var(--touch);
}
.share-qr-wrap {
  background: #fff;
  border-radius: 14px;
  padding: 0.75rem;
  display: inline-block;
  margin: 0.4rem 0 0.75rem;
}
.share-qr-wrap img {
  display: block;
  width: 200px;
  height: 200px;
  border-radius: 8px;
}
.share-qr-wrap .tip {
  margin: 0.45rem 0 0;
  font-size: 0.75rem;
  color: #444;
}
.share-grid {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.share-grid .oauth-btn,
.share-grid .primary {
  width: 100%;
  min-height: 46px;
  font-weight: 800;
}
.wx-share-mask {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0,0,0,0.72);
  color: #fff;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 0.75rem 1rem;
  font-weight: 700;
  line-height: 1.5;
}
.wx-share-mask[hidden] { display: none !important; }
.wx-share-mask .bubble {
  max-width: 220px;
  background: #07c160;
  color: #fff;
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  margin-top: 2.5rem;
  margin-right: 0.25rem;
  position: relative;
}
.wx-share-mask .bubble::after {
  content: '';
  position: absolute;
  top: -10px;
  right: 18px;
  border: 8px solid transparent;
  border-bottom-color: #07c160;
}
.wx-auth-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.75rem max(0.75rem, env(safe-area-inset-right)) calc(0.75rem + env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-left));
  background: rgba(17,17,17,0.96);
  border-top: 2px solid #fff;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
}
.wx-auth-bar[hidden] { display: none !important; }
.wx-auth-bar span { flex: 1 1 140px; }
.wx-auth-bar .primary {
  background: #07c160;
  color: #fff;
  border: none;
  border-radius: 999px;
  min-height: 40px;
  padding: 0.4rem 0.9rem;
  font-weight: 800;
}
.seats { list-style: none; padding: 0; margin: 0 0 1rem; }
.seats li {
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  background: #111;
  border: 2px solid #fff;
  margin-bottom: 0.4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 2px 0 #c40000;
}
.seats .host { color: var(--accent); font-size: 0.75rem; }
.seats .left { display: flex; align-items: center; gap: 0.45rem; min-width: 0; }
.seats .left span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seats .seat-skel {
  opacity: 0.85;
  border: 2px dashed var(--accent);
  background: rgba(255,210,0,0.08);
  box-shadow: none;
  animation: skelPulse 1.4s ease-in-out infinite;
}
.seats .offline { opacity: 0.55; }
@keyframes skelPulse {
  50% { border-color: #fff; background: rgba(255,210,0,0.16); }
}

/* —— 牌桌：一屏铺满，禁止滚动条 —— */
#app:has(#table:not([hidden])) {
  max-width: none;
  width: 100%;
}
body.mode-table {
  background:
    radial-gradient(ellipse at 50% 20%, rgba(0,120,60,0.35), transparent 55%),
    linear-gradient(180deg, #0d2a1c 0%, #071510 100%);
}
body.mode-table.my-turn .table-felt {
  box-shadow:
    0 4px 0 #111,
    inset 0 0 0 3px rgba(255,210,0,0.22),
    0 12px 28px rgba(0,0,0,0.35),
    0 0 0 2px rgba(255,210,0,0.35);
}

.table-felt {
  flex: 1 1 0;
  min-height: 0;
  max-height: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  align-items: stretch;
  gap: 0.25rem;
  padding: 0.35rem 0.4rem 0.45rem;
  border-radius: 16px;
  border: 4px solid #fff;
  box-shadow:
    0 4px 0 #111,
    inset 0 0 0 3px rgba(0,0,0,0.2),
    0 12px 28px rgba(0,0,0,0.35);
  background:
    radial-gradient(ellipse at 50% 40%, rgba(46,140,90,0.55) 0%, rgba(12,70,42,0.85) 55%, rgba(6,36,22,0.95) 100%),
    url("/uno/assets/uno-table-bg.jpg") center / cover;
  background-blend-mode: multiply, normal;
}

.table-screen {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  height: 100dvh;
  max-height: 100dvh;
  min-height: 100dvh;
  padding: max(0.4rem, env(safe-area-inset-top)) max(0.55rem, env(safe-area-inset-right)) 0 max(0.55rem, env(safe-area-inset-left));
  overflow: hidden;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  flex-shrink: 0;
  min-height: 40px;
}
.room-mini {
  color: var(--accent);
  font-weight: 900;
  flex-shrink: 0;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  background: #c40000;
  border: 2px solid #fff;
  border-radius: 8px;
  padding: 0.18rem 0.42rem;
  box-shadow: 0 2px 0 #111;
  opacity: 1;
}
.net-banner,
.pause-banner {
  text-align: center;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.35rem 0.6rem;
  margin: 0;
  z-index: 5;
}
.net-banner {
  background: #111;
  color: #ffd54a;
  border-bottom: 2px solid #ffd54a;
}
.pause-banner {
  background: #c40000;
  color: #fff;
  border-bottom: 2px solid #fff;
}
body.paused-table .table-felt {
  filter: saturate(0.85);
}
.score-vs {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  background: #111;
  border: 2px solid #fff;
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  box-shadow: 0 2px 0 #c40000;
}
.sv-side {
  color: #ffe8e8;
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  max-width: 28%;
  overflow: hidden;
  white-space: nowrap;
  font-weight: 700;
}
.sv-side small {
  font-size: 0.62rem;
  color: var(--accent);
}
.sv-mid {
  font-family: Impact, "Arial Black", var(--display), sans-serif;
  font-size: 1.05rem;
  color: #fff;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.sv-mid b { color: var(--accent); font-weight: 900; }
.sv-mid i { font-style: normal; margin: 0 0.12rem; color: #fff; opacity: 0.55; }
.restart-btn { color: var(--accent); font-size: 1.1rem; font-weight: 700; }
.auto-hint {
  text-align: center;
  color: var(--accent);
  font-size: 0.9rem;
  margin: 0 0 0.75rem;
  min-height: 1.2rem;
}
.claim-btn {
  font-size: 1.15rem;
  letter-spacing: 0.08em;
  min-height: 52px;
  box-shadow: 0 4px 0 #111, 0 0 0 0 rgba(255,210,0,0.45);
}
.claim-btn.ready-pulse:not(:disabled) {
  animation: claimPulse 0.85s ease-in-out infinite;
}
@keyframes claimPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 4px 0 #111, 0 0 0 0 rgba(255,210,0,0.4); }
  50% { transform: scale(1.04); box-shadow: 0 4px 0 #111, 0 0 26px 4px rgba(255,210,0,0.4); }
}
.room-tag { color: var(--accent); font-weight: 700; flex-shrink: 0; }
.scores {
  flex: 1;
  color: var(--muted);
  font-size: 0.75rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.icon-btn {
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 10px;
  font-size: 0.95rem;
  background: #111;
  border: 2px solid #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 0 #c40000;
}

.table-main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
}

.turn-banner {
  text-align: center;
  font-family: Impact, "Arial Black", var(--display), sans-serif;
  font-size: clamp(1rem, 3.4vw, 1.25rem);
  color: #ffe8e8;
  min-height: 1.35rem;
  flex-shrink: 0;
  animation: none;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 0 #111;
}
.turn-banner.mine {
  color: #111;
  background: var(--accent);
  border: 2px solid #111;
  border-radius: 999px;
  padding: 0.22rem 0.85rem;
  margin: 0 auto;
  width: fit-content;
  max-width: 100%;
  box-shadow: 0 3px 0 #111, 0 0 18px rgba(255,210,0,0.35);
  text-shadow: none;
  font-weight: 900;
}
.turn-banner.turn-pop {
  animation: turnPop 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes turnPop {
  0% { transform: scale(0.9); opacity: 0.35; }
  55% { transform: scale(1.08); }
  100% { transform: none; opacity: 1; }
}

.last-play {
  text-align: center;
  font-size: 0.75rem;
  color: #111;
  background: var(--accent);
  border: 2px solid #111;
  border-radius: 999px;
  padding: 0.22rem 0.65rem;
  margin: 0 auto;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
  font-weight: 800;
  box-shadow: 0 2px 0 #111;
}
.coach {
  text-align: center;
  font-size: 0.8rem;
  line-height: 1.35;
  color: #fff;
  background: rgba(0,0,0,0.72);
  border: 2.5px solid var(--accent);
  border-radius: 12px;
  padding: 0.4rem 0.65rem;
  margin: 0 auto;
  max-width: 100%;
  flex-shrink: 0;
  box-shadow: 0 3px 0 #111, 0 0 14px rgba(255,210,0,0.2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-weight: 700;
}
.coach.coach-flash {
  animation: coachFlash 0.55s ease;
}
@keyframes coachFlash {
  0% { background: #c40000; border-color: #fff; transform: scale(1.04); color: var(--accent); }
  100% { background: rgba(0,0,0,0.72); border-color: var(--accent); transform: none; color: #fff; }
}
.hand-hint {
  text-align: center;
  margin: 0;
  padding: 0.2rem 0.45rem 0.05rem;
  font-size: 0.8rem;
  color: var(--accent);
  letter-spacing: 0.02em;
  font-weight: 800;
  text-shadow: 0 1px 0 #111;
}
.hand-hint.warn { color: #ffb4a8; }
.challenge-btn {
  font-size: 1.12rem !important;
  min-height: 52px !important;
  letter-spacing: 0.04em;
  animation: claimPulse 1.1s ease-in-out infinite;
}
.rematch-tip {
  text-align: center;
  margin: 0.55rem 0 0 !important;
  font-size: 0.78rem !important;
  color: var(--accent) !important;
  font-weight: 700;
}
.mode-pick {
  margin: 0 0 0.75rem;
  text-align: center;
}
.mode-label {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  color: #ffe8e8;
  font-weight: 700;
}
.mode-row {
  display: flex;
  gap: 0.35rem;
  justify-content: center;
  flex-wrap: wrap;
}
.mode-btn {
  flex: 1 1 auto;
  min-width: 4.5rem;
  padding: 0.45rem 0.5rem;
  border-radius: 10px;
  border: 2px solid #fff;
  background: #1a1a1a;
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  box-shadow: 0 2px 0 #444;
  cursor: pointer;
}
.mode-btn.active {
  background: #c40000;
  box-shadow: 0 2px 0 #7a0000;
  color: #ffd54a;
}
.mode-btn:disabled {
  opacity: 0.55;
  cursor: default;
}
.size-pick {
  margin: 0.55rem 0 0.75rem;
  text-align: center;
}
.size-row .size-btn {
  flex: 0 0 auto;
  width: 2.45rem;
  height: 2.45rem;
  min-width: 0;
  padding: 0;
  border-radius: 50%;
  border: 2px solid #fff;
  background: #1a1a1a;
  color: #fff;
  font-weight: 800;
  font-size: 0.72rem;
  box-shadow: 0 2px 0 #444;
  cursor: pointer;
}
.size-row {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  max-width: 22rem;
  margin: 0 auto;
}
.size-row .size-btn.active {
  background: #c40000;
  color: #ffd54a;
  box-shadow: 0 2px 0 #7a0000, 0 0 0 2px rgba(255, 213, 74, 0.35);
}
.size-row .size-btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.mode-desc {
  margin: 0.4rem 0 0;
  font-size: 0.72rem;
  color: #ffd54a;
  line-height: 1.35;
}
.rules-chip {
  font-size: 0.78rem;
  color: #ffe8e8;
  line-height: 1.4;
  margin: 0 0 0.75rem;
  padding: 0.45rem 0.6rem;
  border-radius: 10px;
  background: #111;
  border: 2px solid #fff;
  box-shadow: 0 2px 0 #c40000;
}
.linkish {
  display: inline;
  background: none;
  border: none;
  color: var(--accent);
  text-decoration: underline;
  padding: 0;
  min-height: 0;
  font-size: inherit;
  cursor: pointer;
}

.opponents {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  flex-shrink: 0;
  contain: layout style;
  max-height: 38vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.opp {
  text-align: center;
  padding: 0.4rem 0.5rem 0.45rem;
  border-radius: 12px;
  background: #111;
  border: 3px solid #fff;
  min-width: 0;
  flex: 1 1 0;
  max-width: 170px;
  box-shadow: 0 3px 0 #222, 0 8px 16px rgba(0,0,0,0.35);
  transition: box-shadow 0.15s, border-color 0.15s;
}
.opp.turn {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px #111, 0 0 18px rgba(255,210,0,0.45), 0 3px 0 #111;
  transform: none;
}
.opp.self { border-color: #ff8a8a; }
.opp-top {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  text-align: left;
  margin-bottom: 0.3rem;
}
.opp-meta { min-width: 0; flex: 1; }
.opp .you-tag { font-size: 0.65rem; color: var(--accent); }
.opp .av { font-size: 1.25rem; line-height: 1; flex-shrink: 0; }
.opp .name {
  font-weight: 600;
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.opp .score-line { color: var(--muted); font-size: 0.68rem; }
.opp .uno { color: var(--danger); font-weight: 800; }
.catch-btn {
  margin-top: 0.3rem;
  width: 100%;
  min-height: 34px;
  font-size: 0.78rem;
  padding: 0.3rem 0.4rem;
  background: linear-gradient(180deg, #ff3b30, var(--red));
  border: 2px solid #111;
  color: #fff;
  font-weight: 900;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 0 #111;
}
.catch-btn.pulse {
  animation: catchPulse 0.75s ease-in-out infinite;
}
.opp.offline {
  opacity: 0.72;
  border-style: dashed;
}
.off-tag {
  color: #ff8a8a;
  font-weight: 800;
}
.opp.catchable {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px #c40000, 0 0 18px rgba(255,210,0,0.45), 0 3px 0 #111;
}
@keyframes catchPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 2px 0 #111; }
  50% { transform: scale(1.05); box-shadow: 0 2px 0 #111, 0 0 16px rgba(255,210,0,0.55); }
}
.mini-backs {
  position: relative;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mini-backs.empty {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}
.mini-backs i {
  position: absolute;
  width: 18px;
  height: 26px;
  border-radius: 3px;
  background:
    linear-gradient(135deg, #e10600 0 25%, #ffcd00 25% 50%, #00a651 50% 75%, #0072ce 75%),
    #111;
  background-blend-mode: normal;
  border: 1.5px solid #fff;
  box-shadow: 0 1px 0 #111, 0 2px 4px rgba(0,0,0,0.4);
  left: calc(50% - 9px + var(--i) * 3px);
  top: calc(1px + var(--i) * 1px);
}
.mini-backs i::after {
  content: "U";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.45rem;
  font-weight: 900;
  color: #ffcd00;
  font-family: Impact, sans-serif;
  text-shadow: 0 0 1px #000;
  background: rgba(0,0,0,0.55);
  border-radius: 2px;
  margin: 3px 2px;
}
.mini-backs em {
  position: relative;
  z-index: 2;
  font-style: normal;
  font-size: 0.72rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 2px #000;
  background: rgba(0,0,0,0.45);
  border-radius: 999px;
  padding: 0.05rem 0.35rem;
  min-width: 1.2rem;
}
.presence {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.22rem;
  margin: 0.15rem auto 0.35rem;
  max-width: 100%;
  padding: 0 0.35rem;
}
.presence.wait-presence {
  margin: 0.35rem 0 0.55rem;
}
.matchup-line {
  font-size: 0.82rem;
  font-weight: 800;
  color: #fff;
  text-align: center;
  line-height: 1.35;
  background: rgba(0,0,0,0.5);
  border: 2px solid #fff;
  border-radius: 12px;
  padding: 0.35rem 0.65rem;
  box-shadow: 0 2px 0 #c40000;
  max-width: 100%;
}
.matchup-line .seat-n {
  margin-left: 0.35em;
  opacity: 0.7;
  font-size: 0.85em;
  font-weight: 600;
}
.matchup-line .vs {
  display: inline-block;
  margin: 0 0.35rem;
  color: #ffd54a;
  font-family: Impact, "Arial Black", var(--display), sans-serif;
  letter-spacing: 0.04em;
}
.matchup-line b {
  color: #ffe8e8;
}
.watch-line {
  font-size: 0.72rem;
  color: #ffd54a;
  text-align: center;
  line-height: 1.35;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: rgba(0,0,0,0.4);
  border: 1.5px solid rgba(255,213,74,0.45);
}
.watch-line b {
  color: #fff;
  font-size: 0.9em;
}
.on-dot {
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: #2bb673;
  box-shadow: 0 0 0 1px #fff;
  margin-right: 0.2rem;
  vertical-align: middle;
}
.on-dot.off {
  background: #888;
}
.sv-side .sv-name {
  font-size: 0.68rem;
  font-weight: 800;
  max-width: 3.2rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sv-side .on-dot {
  width: 0.38rem;
  height: 0.38rem;
}
.spec-bar {
  text-align: center;
  font-size: 0.68rem;
  color: #ffe8e8;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(0,0,0,0.45);
  border: 1.5px solid rgba(255,255,255,0.35);
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  margin: 0 auto;
  max-width: 100%;
}
.spec-bar.you-spec {
  color: #ffd54a;
  border-color: #ffd54a;
  box-shadow: 0 0 0 1px rgba(196,0,0,0.45);
  font-weight: 700;
}
body.mode-spec .actions #btnDraw,
body.mode-spec .actions #btnUno {
  opacity: 0.45;
}
body.mode-spec .table-dock .reacts,
body.mode-spec .table-dock .roast-toggle {
  outline: 1px dashed rgba(255, 213, 74, 0.45);
  outline-offset: 2px;
  border-radius: 10px;
}

.center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(1.1rem, 5vw, 1.8rem);
  position: relative;
  margin: 0;
  padding: 1.35rem 0 1.45rem; /* 给摸牌标签 / 跟色条留空 */
  flex-shrink: 1;
  min-height: 0;
}
.pile {
  width: var(--card-w);
  height: var(--card-h);
  border-radius: 12px;
  border: 2px solid rgba(255,255,255,0.22);
  box-shadow: 0 8px 18px rgba(0,0,0,0.4);
  position: relative;
  flex-shrink: 0;
}
.pile.back {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  overflow: visible;
  display: block;
  position: relative;
}
.pile.back .card-back-img {
  width: var(--card-w);
  height: var(--card-h);
  object-fit: cover;
  border-radius: 10px;
  border: 3px solid #fff;
  box-shadow: 0 2px 0 #111, 0 8px 18px rgba(0,0,0,0.45);
  display: block;
  position: relative;
  z-index: 3;
}
.pile.back.stacked .stack-layer {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background:
    linear-gradient(135deg, #e10600 0 25%, #ffcd00 25% 50%, #00a651 50% 75%, #0072ce 75%),
    #111;
  border: 3px solid #fff;
  box-shadow: 0 2px 0 #111, 0 4px 10px rgba(0,0,0,0.3);
}
.pile.back.stacked .stack-layer.l1 { transform: translate(3px, 3px) rotate(2deg); z-index: 2; }
.pile.back.stacked .stack-layer.l2 { transform: translate(6px, 5px) rotate(4deg); z-index: 1; }
.pile.back.glow .card-back-img {
  box-shadow: 0 0 0 3px var(--accent), 0 2px 0 #111, 0 8px 18px rgba(0,0,0,0.45);
}
.pile.back.must-draw {
  z-index: 3;
}
.pile.back.must-draw .card-back-img {
  animation: drawPulse 0.9s ease-in-out infinite;
  box-shadow:
    0 0 0 3px var(--accent),
    0 0 22px 6px rgba(255,210,0,0.55),
    0 2px 0 #111,
    0 8px 18px rgba(0,0,0,0.45);
}
.pile.back.must-draw .pile-label {
  color: #ffe7a8;
  font-size: 0.78rem;
  animation: drawLabelBlink 1s ease-in-out infinite;
}
.draw-nudge {
  position: absolute;
  left: 50%;
  top: -1.55rem;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 0.72rem;
  font-weight: 900;
  color: #111;
  background: var(--accent);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 2px solid #111;
  z-index: 5;
  pointer-events: none;
  animation: drawNudgeBob 0.85s ease-in-out infinite;
  box-shadow: 0 3px 0 #111;
}
@keyframes drawPulse {
  50% { transform: scale(1.07); }
}
@keyframes drawLabelBlink {
  50% { opacity: 0.55; }
}
@keyframes drawNudgeBob {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-4px); }
}
.actions > button.must-draw {
  background: linear-gradient(180deg, #ffe44d, var(--accent));
  color: #111;
  font-weight: 900;
  border-color: #111;
  animation: claimPulse 0.9s ease-in-out infinite;
  box-shadow: 0 3px 0 #111, 0 0 18px rgba(255,210,0,0.55);
}
.hand-hint.draw-now {
  color: var(--accent);
  font-weight: 800;
  font-size: 0.8rem;
  animation: coachFlash 0.8s ease infinite;
}
.pile.back .pile-label {
  position: absolute;
  left: 50%;
  bottom: -1.45rem;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 900;
  text-shadow: 0 1px 0 #111, 0 0 6px rgba(0,0,0,0.6);
  pointer-events: none;
  white-space: nowrap;
  letter-spacing: 0.04em;
}
.pile.back .pile-label b { font-size: 0.72rem; }
.pile.back .pile-label small { opacity: 0.85; font-weight: 700; }
.pile.back:active .card-back-img { transform: scale(0.97); }
.pile.face {
  background: transparent;
  border: none;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
}
.pile.face .card {
  width: calc(var(--card-w) * 1.1);
  height: calc(var(--card-h) * 1.1);
  animation: land 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
.pile.face .card .oval-txt { font-size: 1.85rem; }
.pile.face .card.action .oval-txt { font-size: 1.25rem; }
.pile.face .card .corner { font-size: 0.9rem; }
@keyframes land {
  from { transform: translateY(-18px) rotate(-8deg) scale(0.9); opacity: 0.2; }
  to { transform: none; opacity: 1; }
}
.discard-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
}
.follow-hint {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  padding: 0.32rem 0.75rem;
  border-radius: 999px;
  background: #111;
  border: 2px solid #fff;
  color: #fff;
  white-space: nowrap;
  box-shadow: 0 2px 0 #111;
  text-shadow: 0 1px 1px rgba(0,0,0,0.35);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.follow-hint .dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: currentColor;
  border: 1.5px solid #fff;
  box-shadow: 0 1px 0 #111;
  flex-shrink: 0;
}
.follow-hint b { font-weight: 900; }
.follow-hint.red { background: var(--red); border-color: #fff; color: #fff; }
.follow-hint.red .dot { background: #fff; border-color: #111; }
.follow-hint.yellow { background: var(--yellow); border-color: #111; color: #111; text-shadow: none; }
.follow-hint.yellow .dot { background: #111; border-color: #fff; }
.follow-hint.green { background: var(--green); border-color: #fff; color: #fff; }
.follow-hint.green .dot { background: #fff; border-color: #111; }
.follow-hint.blue { background: var(--blue); border-color: #fff; color: #fff; }
.follow-hint.blue .dot { background: #fff; border-color: #111; }
.follow-hint.danger {
  animation: dangerPulse 1s ease-in-out infinite;
  border-color: var(--accent);
}
@keyframes dangerPulse {
  50% { box-shadow: 0 0 14px rgba(255,210,0,0.55); transform: scale(1.03); }
}

@keyframes pop {
  0% { transform: translate(-50%, 8px) scale(0.4); opacity: 0; }
  30% { opacity: 1; transform: translate(-50%, -4px) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -36px) scale(1); }
}

/* 底栏：紧贴底部，不再滚动 */
.table-dock {
  flex: 0 0 auto;
  overflow: hidden;
  padding: 0.15rem 0 calc(0.25rem + var(--pad-b));
  background: linear-gradient(180deg, rgba(0,0,0,0.35), rgba(10,0,0,0.92));
  border-top: 3px solid #fff;
  box-shadow: 0 -3px 0 #c40000;
}
.actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: nowrap;
  padding: 0.15rem 0.2rem 0.2rem;
}
.actions > button {
  min-width: 68px;
  min-height: 38px;
  padding: 0.4rem 0.7rem;
  font-size: 0.92rem;
  background: #111;
  border: 2px solid #fff;
  color: #fff;
  font-weight: 800;
  box-shadow: 0 2px 0 #c40000;
}
.uno-btn {
  background: linear-gradient(180deg, #ff4d4d, var(--danger));
  color: #fff;
  font-weight: 900;
  letter-spacing: 0.06em;
  border: 2px solid #111;
  box-shadow: 0 3px 0 #111, 0 6px 12px rgba(230,0,0,0.35);
  text-shadow: 0 1px 0 rgba(0,0,0,0.35);
}
.uno-btn.pulse:not(:disabled) {
  animation: unoPulse 1.1s ease-in-out infinite;
}
@keyframes unoPulse {
  50% { transform: scale(1.05); box-shadow: 0 0 18px rgba(232,106,90,0.55); }
}
.reacts { display: flex; gap: 0.2rem; flex-shrink: 0; }
.react {
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  background: #111;
  border: 2px solid #fff;
  border-radius: 10px;
  font-size: 0.95rem;
  box-shadow: 0 2px 0 #c40000;
}
.roast-toggle {
  flex-shrink: 0;
  min-height: 36px;
  min-width: 44px;
  padding: 0.25rem 0.55rem;
  font-size: 0.72rem;
  border-radius: 10px;
  background: var(--accent);
  border: 2px solid #111;
  color: #111;
  font-weight: 900;
  box-shadow: 0 2px 0 #111;
}
.roast-toggle.on {
  background: #fff;
  color: #c40000;
}
.roast-row {
  display: flex;
  justify-content: center;
  gap: 0.3rem;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.15rem 0.4rem 0.25rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  animation: screenIn 0.22s ease;
}
.roast-row::-webkit-scrollbar { display: none; width: 0; height: 0; }
.roast {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 0.25rem 0.55rem;
  font-size: 0.72rem;
  border-radius: 999px;
  background: #111;
  border: 2px solid #fff;
  color: var(--accent);
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 2px 0 #c40000;
}

.float-react {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  font-size: 0.95rem;
  animation: pop 1.1s ease forwards;
  pointer-events: none;
  z-index: 2;
  background: #c40000;
  border: 3px solid #fff;
  border-radius: 12px;
  padding: 0.4rem 0.7rem;
  max-width: min(88vw, 300px);
  text-align: center;
  line-height: 1.3;
  box-shadow: 0 3px 0 #111, 0 8px 22px rgba(0,0,0,0.35);
}
.float-react .fr-emoji { font-size: 1.25rem; display: block; }
.float-react .fr-text { color: var(--accent); font-weight: 900; text-shadow: 1px 1px 0 #111; }

.splash {
  position: fixed;
  top: max(0.55rem, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 55;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  width: min(94vw, 380px);
  margin: 0;
  padding: 0;
  background: transparent;
  backdrop-filter: none;
  pointer-events: none;
}
.splash.splash-pop .splash-inner {
  animation: tipIn 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.splash-inner {
  text-align: center;
  width: 100%;
  padding: 0.75rem 1rem 0.85rem;
  border-radius: 16px;
  background: #c40000;
  border: 4px solid #fff;
  box-shadow: 0 5px 0 #111, 0 14px 32px rgba(0,0,0,0.45);
  animation: tipIn 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
.splash-big {
  font-family: Impact, "Arial Black", var(--display), sans-serif;
  font-size: clamp(1.45rem, 6vw, 1.85rem);
  color: var(--accent);
  text-shadow: 2px 2px 0 #111, -1px -1px 0 #111;
  letter-spacing: 0.06em;
  line-height: 1.15;
  -webkit-text-stroke: 0;
}
.splash-big.stack { color: #fff; text-shadow: 0 0 14px rgba(0,0,0,0.55), 2px 2px 0 #111; }
.splash-big.win { color: var(--accent); text-shadow: 2px 2px 0 #111, 0 0 14px rgba(255,210,0,0.5); }
.splash-sub {
  margin-top: 0.35rem;
  font-size: 0.9rem;
  color: #ffe8e8;
  background: transparent;
  display: block;
  padding: 0;
  border-radius: 0;
  line-height: 1.35;
  font-weight: 800;
}
.splash-img {
  width: min(72px, 22vw);
  height: auto;
  margin: 0 auto 0.25rem;
  display: block;
  border-radius: 10px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.35);
}
@keyframes tipIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.96); }
  to { opacity: 1; transform: none; }
}
@keyframes splashIn {
  from { transform: scale(0.4) rotate(-8deg); opacity: 0; }
  to { transform: scale(1) rotate(0); opacity: 1; }
}

.deal-fx {
  position: fixed;
  top: max(3.2rem, calc(env(safe-area-inset-top) + 2.8rem));
  left: 50%;
  transform: translateX(-50%);
  z-index: 54;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 0.85rem;
  border-radius: 14px;
  background: #111;
  border: 3px solid #fff;
  box-shadow: 0 4px 0 #c40000, 0 12px 28px rgba(0,0,0,0.4);
  backdrop-filter: none;
  pointer-events: none;
  width: auto;
  inset: auto;
}
.deal-fan { display: flex; gap: 0.35rem; }
.deal-fan i {
  width: 42px;
  height: 64px;
  border-radius: 8px;
  border: 3px solid #fff;
  box-shadow: 0 2px 0 #111, 0 8px 18px rgba(0,0,0,0.35);
  animation: dealFlip 0.7s ease infinite;
  position: relative;
  overflow: hidden;
}
.deal-fan i::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: #fff;
  transform: rotate(-18deg) scaleY(0.72);
}
.deal-fan i:nth-child(2) { animation-delay: 0.08s; }
.deal-fan i:nth-child(3) { animation-delay: 0.16s; }
.deal-fan i:nth-child(4) { animation-delay: 0.24s; }
.deal-fan .r { background: var(--red); }
.deal-fan .y { background: var(--yellow); }
.deal-fan .g { background: var(--green); }
.deal-fan .b { background: var(--blue); }
@keyframes dealFlip {
  0%, 100% { transform: translateY(0) rotate(0); }
  40% { transform: translateY(-14px) rotate(-8deg); }
  70% { transform: translateY(-6px) rotate(6deg); }
}
.deal-msg {
  margin: 0;
  color: var(--accent);
  font-family: var(--display);
  letter-spacing: 0.08em;
}

button.ready-pulse:not(:disabled) {
  animation: readyPulse 1.2s ease-in-out infinite;
}
@keyframes readyPulse {
  50% { transform: scale(1.03); box-shadow: 0 0 22px rgba(240,197,109,0.45); }
}

/* —— 手牌区：动态叠压 + 溢出导航 —— */
.hand-rail {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}
.hand-rail.is-overflow::before,
.hand-rail.is-overflow::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0.2rem;
  width: 28px;
  z-index: 5;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.hand-rail.is-overflow.can-left::before {
  left: 0;
  opacity: 1;
  background: linear-gradient(90deg, rgba(10,0,0,0.85), transparent);
}
.hand-rail.is-overflow.can-right::after {
  right: 0;
  opacity: 1;
  background: linear-gradient(270deg, rgba(10,0,0,0.85), transparent);
}
.hand-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-55%);
  z-index: 6;
  width: 32px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 10px;
  border: 2px solid #fff;
  background: #c40000;
  color: #ffcd00;
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 2px 0 #111;
}
.hand-nav:disabled {
  opacity: 0.35;
}
.hand-nav.left { left: 2px; }
.hand-nav.right { right: 2px; }
.hand-more {
  margin: 0.1rem 0 0;
  text-align: center;
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.04em;
  min-height: 1em;
}

.hand {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  overflow-x: auto;
  overflow-y: hidden;
  gap: 0;
  padding: 1rem 0.7rem 0.55rem;
  min-height: calc(var(--card-h) + 36px);
  width: 100%;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  contain: layout style;
  scroll-behavior: smooth;
  --overlap: 14px;
  --fan-amp: 1.15;
}
.hand.is-overflow {
  justify-content: flex-start; /* 溢出时从左排布，方便滑 */
  padding-left: 2.1rem;
  padding-right: 2.1rem;
}
.hand::-webkit-scrollbar { display: none; width: 0; height: 0; }
.hand .card {
  flex: 0 0 auto;
  margin-left: calc(-1 * var(--overlap, 14px));
  transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.18s ease, opacity 0.12s, margin-left 0.18s ease;
  transform: rotate(calc(var(--fan, 0) * var(--fan-amp, 1.15) * 1deg));
  overflow: visible;
  touch-action: manipulation;
}
.hand .card:first-child { margin-left: 0; }
.hand .card.playable {
  transform: rotate(calc(var(--fan, 0) * var(--fan-amp, 1.15) * 1deg)) translateY(-16px) scale(1.04);
  cursor: pointer;
  z-index: 4;
  will-change: transform;
  box-shadow:
    0 8px 18px rgba(0,0,0,0.38),
    0 0 0 1px rgba(255,205,0,0.25);
}
/* 参考图：仅左上 + 右下对角黄 L */
.hand .card.playable::before,
.hand .card.playable::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  pointer-events: none;
  z-index: 7;
  box-sizing: border-box;
}
.hand .card.playable::before {
  display: block;
  top: -8px;
  left: -8px;
  border-top: 3px solid #ffcd00;
  border-left: 3px solid #ffcd00;
  border-radius: 8px 0 0 0;
  filter: drop-shadow(0 1px 0 rgba(0,0,0,0.35));
}
.hand .card.playable::after {
  top: auto;
  left: auto;
  right: -8px;
  bottom: -8px;
  border-bottom: 3px solid #ffcd00;
  border-right: 3px solid #ffcd00;
  border-radius: 0 0 8px 0;
  background: none;
  filter: drop-shadow(0 1px 0 rgba(0,0,0,0.35));
}
.hand .card:not(.playable) {
  opacity: 0.9;
}
.hand.my-turn .card:not(.playable) {
  opacity: 0.55;
  transform: rotate(calc(var(--fan, 0) * var(--fan-amp, 1.15) * 1deg)) scale(0.96);
}
.hand .card.playable:active {
  transform: rotate(calc(var(--fan, 0) * var(--fan-amp, 1.15) * 1deg)) translateY(-10px) scale(1.01);
}
.hand .card.flying {
  opacity: 0.25;
  transform: translateY(-28px) scale(0.85);
  pointer-events: none;
  filter: blur(0.5px);
}
.hand .card.deal-in {
  animation: dealIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes dealIn {
  from { opacity: 0; transform: translateY(18px) scale(0.88); }
  to { opacity: 1; }
}
.hand-spec {
  margin: auto;
  padding: 0.5rem;
  text-align: center;
  line-height: 1.45;
  color: #ffe8e8 !important;
}
.hand-spec small {
  display: inline-block;
  margin-top: 0.25rem;
  color: #ffd54a;
  font-size: 0.78rem;
}
.pile.tap, .actions > button.tap {
  transform: scale(0.94);
  filter: brightness(1.1);
}
button.is-busy { opacity: 0.7; }

/* —— 官方 UNO 牌面（对标黄9参考图） —— */
.card {
  width: var(--card-w);
  height: var(--card-h);
  border-radius: 11px;
  border: 3.5px solid #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.15rem;
  user-select: none;
  position: relative;
  box-shadow: 0 4px 12px rgba(0,0,0,0.32);
  color: #fff;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  isolation: isolate;
  backface-visibility: hidden;
}
.card::before { content: none; display: none; }
.card.on-table {
  transform: rotate(-7deg);
  box-shadow: 0 6px 16px rgba(0,0,0,0.4);
  overflow: hidden;
}
.card .corner {
  position: absolute;
  top: 5px;
  left: 7px;
  font-size: 0.82rem;
  line-height: 1;
  font-weight: 900;
  z-index: 3;
  font-family: Impact, "Arial Black", "Helvetica Neue", sans-serif;
  color: #fff;
  text-shadow: 0 1px 1px rgba(0,0,0,0.4);
  letter-spacing: -0.03em;
}
.card .corner.br {
  left: auto;
  right: 7px;
  top: auto;
  bottom: 5px;
  transform: rotate(180deg);
}
.card .oval {
  width: 78%;
  height: 56%;
  border-radius: 50%;
  background: #fff;
  color: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(-35deg);
  z-index: 2;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
  position: relative;
  overflow: hidden;
}
.card .oval-txt {
  font-size: 1.4rem;
  font-weight: 900;
  line-height: 1;
  transform: rotate(35deg);
  font-family: Impact, "Arial Black", "Helvetica Neue", "Noto Sans SC", sans-serif;
  letter-spacing: -0.04em;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.22);
  display: flex;
  align-items: center;
  justify-content: center;
}
.card.action .oval-txt { font-size: 1.15rem; }

.card .sym {
  display: block;
  position: relative;
  flex-shrink: 0;
}
.card .sym-skip {
  width: 1.15em;
  height: 1.15em;
  border: 0.14em solid currentColor;
  border-radius: 50%;
  box-sizing: border-box;
}
.card .sym-skip::after {
  content: "";
  position: absolute;
  left: -18%;
  top: 50%;
  width: 136%;
  height: 0.14em;
  background: currentColor;
  border-radius: 2px;
  transform: translateY(-50%) rotate(-40deg);
}
.card .sym-rev {
  width: 1.25em;
  height: 0.95em;
}
.card .sym-rev::before,
.card .sym-rev::after {
  content: "";
  position: absolute;
  width: 0.72em;
  height: 0.72em;
  border: 0.13em solid currentColor;
  border-radius: 50%;
  border-color: currentColor transparent transparent currentColor;
  box-sizing: border-box;
}
.card .sym-rev::before {
  left: 0;
  top: 0;
  transform: rotate(-25deg);
}
.card .sym-rev::after {
  right: 0;
  bottom: 0;
  transform: rotate(155deg);
}

.card.red { background: #e10600; }
.card.red .oval-txt { color: #e10600; }
.card.red .corner { color: #fff; }

.card.yellow { background: #ffcd00; color: #111; }
.card.yellow .oval-txt { color: #ffcd00; text-shadow: 2px 2px 0 rgba(0,0,0,0.2); }
.card.yellow .corner { color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,0.35); }

.card.green { background: #00a651; }
.card.green .oval-txt { color: #00a651; }
.card.green .corner { color: #fff; }

.card.blue { background: #0072ce; }
.card.blue .oval-txt { color: #0072ce; }
.card.blue .corner { color: #fff; }

.card.wild { background: #111; }
.card.wild .corner { color: #fff; text-shadow: 0 1px 2px #000; }
.card.wild .oval {
  background: #111;
  box-shadow: inset 0 0 0 2.5px #fff;
}
.card.wild .oval-txt {
  color: #ffcd00;
  z-index: 2;
  position: relative;
  text-shadow: 0 1px 2px #000, 1px 1px 0 #111;
  font-size: 1.25rem;
}
.card .wild-pie {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  transform: rotate(35deg) scale(1.25);
  z-index: 0;
}
.card .wild-pie i { display: block; }
.card .wild-pie .r { background: #e10600; }
.card .wild-pie .y { background: #ffcd00; }
.card .wild-pie .g { background: #00a651; }
.card .wild-pie .b { background: #0072ce; }

.log {
  font-size: 0.68rem;
  color: var(--muted);
  height: 1.15rem;
  max-height: 1.15rem;
  overflow: hidden;
  line-height: 1.15rem;
  padding: 0 0.5rem;
  opacity: 0.85;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.log > div { display: none; }
.log > div:last-child { display: block; overflow: hidden; text-overflow: ellipsis; }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.58);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}
.modal-box {
  background: #1a0505;
  padding: 1.2rem 1.2rem calc(1.2rem + env(safe-area-inset-bottom));
  border-radius: 18px 18px 0 0;
  width: min(420px, 100%);
  text-align: center;
  position: relative;
  border: 3px solid #fff;
  border-bottom: none;
  box-shadow: 0 -4px 0 #c40000;
  max-height: min(90dvh, 640px);
  overflow: auto;
}
.color-title { margin: 0; font-family: var(--display); font-size: 1.2rem; }
.color-sub { margin: 0.25rem 0 0.85rem; color: var(--muted); font-size: 0.85rem; }
.modal.modal-in .modal-box {
  animation: sheetUp 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes sheetUp {
  from { transform: translateY(24px); opacity: 0.4; }
  to { transform: none; opacity: 1; }
}
.rules-box { text-align: left; }
.rules-box h3 {
  font-family: var(--display);
  margin: 0 1.5rem 0.35rem 0;
  font-weight: 400;
  font-size: 1.35rem;
}
.rules-lead {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 0.85rem;
  line-height: 1.45;
}
.rules-body {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 1rem;
  max-height: min(52dvh, 420px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.rules-item {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 0.45rem;
  padding: 0.5rem 0.55rem;
  border-radius: 10px;
  background: #111;
  border: 2px solid rgba(255,255,255,0.35);
  font-size: 0.82rem;
  line-height: 1.4;
}
.rules-item b {
  color: var(--accent);
  font-size: 0.78rem;
}
.rules-item span { color: var(--ink); }
.auth-box { text-align: left; }
.auth-box .close {
  position: absolute;
  right: 0.45rem;
  top: 0.35rem;
  background: transparent;
  font-size: 1.45rem;
  color: var(--muted);
  padding: 0;
  width: var(--touch);
  height: var(--touch);
  min-height: var(--touch);
}
.avatars { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.9rem; }
.avatars button {
  width: 44px;
  height: 44px;
  min-height: 44px;
  border-radius: 12px;
  font-size: 1.3rem;
  background: rgba(0,0,0,0.25);
  border: 2px solid transparent;
  padding: 0;
}
.avatars button.on { border-color: var(--accent); background: rgba(255,210,0,0.2); box-shadow: 0 0 0 1px #111; }
.oauth { display: flex; gap: 0.5rem; margin-top: 0.75rem; flex-wrap: wrap; }
.oauth-btn { flex: 1 1 120px; font-weight: 600; }
.oauth-btn.wx { background: #07c160; color: #fff; }
.oauth-btn.qq { background: #12b7f5; color: #fff; }

.privacy-box { text-align: left; max-width: 420px; }
.privacy-box h3 { margin: 0 0 0.65rem; }
.privacy-body {
  background: rgba(0,0,0,0.22);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  line-height: 1.55;
  font-size: 0.9rem;
}
.privacy-body p { margin: 0 0 0.65rem; }
.privacy-body p:last-child { margin-bottom: 0; }
.privacy-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.privacy-actions .ghost,
.privacy-actions .primary {
  flex: 1 1 140px;
}

.colors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-top: 0.85rem;
}
.c {
  min-height: 64px;
  height: auto;
  width: auto;
  border-radius: 14px;
  border: 3px solid #fff;
  padding: 0.75rem;
  box-shadow: 0 3px 0 #111, 0 8px 16px rgba(0,0,0,0.3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.05rem;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}
.c span {
  background: transparent;
  color: inherit;
  border-radius: 0;
  padding: 0;
  line-height: 1.2;
  font-weight: 900;
}
.c.yellow span { background: transparent; color: #111; }
.c.red { background: var(--red); }
.c.yellow { background: var(--yellow); color: #111; text-shadow: none; }
.c.green { background: var(--green); }
.c.blue { background: var(--blue); }

.end-panel { text-align: center; position: relative; overflow: hidden; }
.end-vs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0.85rem 0 1.1rem;
}
.ev-side {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.55rem 0.4rem;
  background: #111;
  border: 3px solid #fff;
  border-radius: 14px;
  box-shadow: 0 3px 0 #c40000;
}
.ev-av { font-size: 1.6rem; line-height: 1; }
.ev-name {
  font-size: 0.85rem;
  font-weight: 700;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ev-lv {
  font-size: 0.68rem;
  color: var(--accent);
}
.ev-score {
  font-family: var(--display);
  font-size: clamp(1.8rem, 8vw, 2.4rem);
  color: var(--ink);
  flex-shrink: 0;
  letter-spacing: 0.04em;
}
.ev-score b { color: var(--accent); font-weight: 400; }
.ev-score i { font-style: normal; margin: 0 0.15rem; color: var(--muted); }
.confetti { pointer-events: none; position: absolute; inset: 0; overflow: hidden; }

.boss {
  position: fixed;
  inset: 0;
  background: #f4f4f4;
  color: #222;
  z-index: 60;
  padding: max(1.5rem, env(safe-area-inset-top)) 1.25rem;
  overflow: auto;
}
.fake-doc {
  max-width: 640px;
  margin: 0 auto;
  font-family: "Times New Roman", "Songti SC", serif;
}
.fake-doc .muted { color: #888; font-size: 0.85rem; margin-top: 2rem; }

#fx { position: fixed; inset: 0; pointer-events: none; z-index: 0; }

/* —— 平板 —— */
@media (min-width: 640px) {
  :root {
    --card-w: 64px;
    --card-h: 96px;
    --pad: 1.25rem;
    --pad-r: 1.25rem;
  }
  .lobby-body {
    justify-content: center;
    max-width: 460px;
  }
  .modal { align-items: center; padding: 1rem; }
  .modal-box {
    border-radius: 18px;
    padding: 1.35rem;
  }
  .opp { max-width: 180px; flex: 0 1 160px; }
}

/* —— 桌面 —— */
@media (min-width: 900px) {
  :root {
    --card-w: 72px;
    --card-h: 108px;
  }
  #app { width: min(100%, 1080px); }
  #app:has(#table:not([hidden])) {
    width: min(100%, 920px);
    margin: 0 auto;
  }
  .table-screen {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  .table-felt {
    padding: 0.5rem 0.85rem 0.6rem;
  }
  .table-dock {
    padding-left: 0.35rem;
    padding-right: 0.35rem;
  }
  .hand {
    justify-content: center;
    padding: 0.95rem 0.75rem 0.5rem;
  }
  .hand .card.playable:hover {
    transform: rotate(calc(var(--fan, 0) * var(--fan-amp, 1.15) * 1deg)) translateY(-18px) scale(1.06);
    z-index: 5;
  }
  .hand .card.playable:hover::before,
  .hand .card.playable:hover::after {
    width: 20px;
    height: 20px;
  }
  .opp { min-width: 130px; padding: 0.45rem 0.85rem; }
  .center { gap: 1.6rem; }
  .follow-hint { font-size: 0.8rem; }
  .actions > button { min-width: 88px; }
  .react { width: 38px; height: 38px; min-height: 38px; }
  .card .oval-txt { font-size: 1.95rem; }
  .card.action .oval-txt { font-size: 1.25rem; }
  .card .corner { font-size: 0.95rem; }
}

/* —— 超宽桌面 —— */
@media (min-width: 1100px) {
  #app:has(#table:not([hidden])) { width: min(100%, 960px); }
}

/* —— 矮屏 / 横屏手机 —— */
@media (max-height: 640px) and (orientation: landscape) {
  :root { --card-w: 48px; --card-h: 72px; }
  .table-felt { padding: 0.2rem 0.4rem; gap: 0.15rem; }
  .last-play { font-size: 0.7rem; padding: 0.18rem 0.5rem; }
  .opp { padding: 0.2rem 0.4rem; }
  .opp .av { font-size: 1rem; }
  .log { display: none; }
  .hand { min-height: calc(var(--card-h) + 22px); padding: 0.55rem 0.4rem 0.3rem; }
  .card .oval-txt { font-size: 1.15rem; }
  .card.action .oval-txt { font-size: 0.78rem; }
  .card .corner { font-size: 0.62rem; top: 3px; left: 4px; }
  .card .corner.br { right: 4px; bottom: 3px; }
  .hand .card.playable::before,
  .hand .card.playable::after {
    width: 12px;
    height: 12px;
    border-width: 2px;
  }
  .hand .card.playable::before { top: -5px; left: -5px; }
  .hand .card.playable::after { right: -5px; bottom: -5px; }
  .turn-banner { font-size: 0.88rem; }
  .center { padding-bottom: 0.9rem; }
}

/* 减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  .pile.face .card, .float-react, .hand .card, .splash-inner,
  .screen.screen-enter, .turn-banner.turn-pop, .hand .card.deal-in, .seats .seat-skel,
  .deal-fan i, button.ready-pulse, .modal.modal-in .modal-box,
  .pile.back.must-draw .card-back-img, .draw-nudge, .actions > button.must-draw, .hand-hint.draw-now {
    animation: none !important; transition: none !important;
  }
}
