/* ============================================================
   Arena · 设计令牌
   风格：瑞士 / 极简 · 强网格 · 大留白 · 少装饰
   ============================================================ */

:root {
  --bg: #f7f6f3;
  --ink: #1c1b19;
  --ink-2: #5f5c55;
  --ink-3: #938f86;
  --brand: #d97757;
  --brand-deep: #b85c3c;
  --brand-soft: #f5e6df;
  --brand-softer: #fbf4f0;
  --card: #ffffff;
  --line: #e3e0d9;
  --line-soft: #efede7;
  --line-strong: #d9d4c8;
  --brand-ink: #8c3f22;
  --ok: #4f8a6d;
  --ok-soft: #eaf1ec;
  --warn: #b8860b;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(28, 27, 25, 0.04);
  --shadow-md: 0 4px 16px rgba(28, 27, 25, 0.06);
  --font: "PingFang SC", "HarmonyOS Sans SC", "Noto Sans SC", "Microsoft YaHei",
    -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SF Mono", "JetBrains Mono", "Cascadia Code", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

/* display:grid/flex 的 class 会盖掉 UA 的 [hidden]，这里强制生效 */
[hidden] {
  display: none !important;
}

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

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

button:disabled {
  cursor: not-allowed;
}

a {
  color: inherit;
  text-decoration: none;
}

::selection {
  background: var(--brand-soft);
  color: var(--brand-deep);
}

/* ============================================================
   顶栏
   ============================================================ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 32px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  display: flex;
  gap: 3px;
  align-items: center;
}

.brand-mark i {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
}

.brand-mark i:nth-child(2) {
  background: var(--ink);
}

.brand-mark i:nth-child(3) {
  background: var(--ink-3);
}

.brand-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-sub {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.nav {
  display: flex;
  gap: 4px;
  margin-left: 12px;
}

.nav a {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  transition: background 0.15s, color 0.15s;
}

.nav a:hover {
  background: var(--line-soft);
  color: var(--ink);
}

.nav a.is-active {
  color: var(--ink);
  background: var(--line-soft);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px 7px 8px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  transition: background 0.15s, color 0.15s;
}

.back-link:hover {
  background: var(--line-soft);
  color: var(--ink);
}

.crumb {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.crumb-code {
  font-family: var(--mono);
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--line-soft);
  color: var(--ink-2);
}

/* ============================================================
   通用按钮
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.08s;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--brand);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--brand-deep);
}

.btn-primary:disabled {
  background: #ddd9d2;
  color: #9a968d;
}

.btn-ghost {
  background: var(--line-soft);
  color: var(--ink-2);
}

.btn-ghost:hover:not(:disabled) {
  background: #e6e3db;
  color: var(--ink);
}

.btn-outline {
  background: transparent;
  color: var(--ink-2);
  box-shadow: inset 0 0 0 1px var(--line);
}

.btn-outline:hover:not(:disabled) {
  background: #fff;
  color: var(--ink);
}

.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 500;
}

.btn-block {
  width: 100%;
}

.btn-danger {
  background: transparent;
  color: #b4462f;
  box-shadow: inset 0 0 0 1px #e8cfc7;
}

.btn-danger:hover:not(:disabled) {
  background: #fdf1ed;
}

/* 不补这两条的话，「开！」在没有喊价时看起来依然像能点 */
.btn-danger:disabled {
  color: #c9b3ad;
  box-shadow: inset 0 0 0 1px #eee3df;
}

.btn-outline:disabled,
.btn-ghost:disabled {
  opacity: 0.5;
}

/* ============================================================
   布局
   ============================================================ */

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 32px 72px;
}

.page-wide {
  max-width: 1360px;
}

.stack {
  display: flex;
  flex-direction: column;
}

.row {
  display: flex;
  align-items: center;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.section-desc {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--ink-3);
}

.label-xs {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ============================================================
   大厅 Hero
   ============================================================ */

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px;
  padding-bottom: 36px;
  margin-bottom: 36px;
  border-bottom: 1px solid var(--line);
}

.hero-title {
  margin: 0;
  font-size: 46px;
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.hero-title em {
  font-style: normal;
  color: var(--brand);
}

.hero-sub {
  margin: 14px 0 0;
  max-width: 480px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink-2);
}

.hero-stats {
  display: flex;
  gap: 40px;
  padding-bottom: 6px;
}

.stat-value {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.stat-label {
  margin-top: 4px;
  font-size: 12px;
  color: var(--ink-3);
}

/* ============================================================
   游戏卡
   ============================================================ */

.game-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.game-card {
  display: flex;
  flex-direction: column;
  padding: 22px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: box-shadow 0.18s, border-color 0.18s, transform 0.18s;
}

.game-card:hover {
  border-color: #d6d2c9;
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.game-card.is-locked {
  opacity: 0.62;
}

.game-card.is-locked:hover {
  transform: none;
  box-shadow: var(--shadow);
}

.game-art {
  height: 112px;
  margin-bottom: 18px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.game-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.game-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.tag {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--line-soft);
  color: var(--ink-2);
  white-space: nowrap;
}

.tag-live {
  background: var(--ok-soft);
  color: var(--ok);
}

.tag-soon {
  background: var(--brand-softer);
  color: var(--brand-deep);
}

.game-desc {
  margin: 8px 0 16px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink-2);
  flex: 1;
}

.game-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}

.game-meta {
  font-size: 12px;
  color: var(--ink-3);
}

/* ============================================================
   房间列表
   ============================================================ */

.room-list {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.room-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.15s;
}

.room-row:last-child {
  border-bottom: none;
}

.room-row:hover {
  background: #fbfaf8;
}

.room-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
}

.room-main {
  flex: 1;
  min-width: 0;
}

.room-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

.room-code {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 400;
}

.room-sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--ink-3);
}

.room-count {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
}

.empty {
  padding: 44px 20px;
  text-align: center;
  color: var(--ink-3);
  font-size: 13px;
}

/* ============================================================
   房间页
   ============================================================ */

.room-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 28px;
  align-items: start;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel-pad {
  padding: 22px;
}

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

.panel-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* 座位 */

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

.seat {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 16px;
  min-height: 176px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fdfcfa;
  text-align: center;
}

.seat.is-empty {
  border-style: dashed;
  background: transparent;
}

.seat.is-me {
  border-color: var(--brand);
  background: var(--brand-softer);
}

.seat.is-observer .seat-avatar {
  background: var(--line-soft);
  color: var(--ink-3);
}

.seat-avatar {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
}

.seat-avatar.is-empty {
  background: transparent;
  border: 1px dashed #cfcbc2;
  color: #b8b3a8;
  font-size: 22px;
  font-weight: 400;
}

.seat-name {
  font-size: 14px;
  font-weight: 600;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seat-role {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.seat-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--line-soft);
  color: var(--ink-3);
}

.seat-state.is-ready {
  background: var(--ok-soft);
  color: var(--ok);
}

.seat-state i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  display: block;
}

.seat-actions {
  margin-top: auto;
  display: flex;
  gap: 8px;
}

.seat-offline {
  font-size: 11px;
  color: var(--brand-deep);
}

.host-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--brand-soft);
  color: var(--brand-deep);
}

/* 开始区 */

.start-block {
  margin-top: 22px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fdfcfa;
}

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

.start-count {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--brand);
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: var(--line-soft);
  overflow: hidden;
  margin-bottom: 16px;
}

.progress > i {
  display: block;
  height: 100%;
  min-width: 0;
  border-radius: 999px;
  background: var(--brand);
  transition: width 0.28s ease;
}

.start-note {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--brand-softer);
  font-size: 12px;
  line-height: 1.6;
  color: var(--brand-deep);
}

.start-note strong {
  font-weight: 700;
}

/* 设置项 */

.setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
}

.setting:last-child {
  border-bottom: none;
}

.setting-key {
  color: var(--ink-2);
}

.setting-value {
  font-weight: 600;
  color: var(--ink);
}

/* 聊天 */

.chat-log {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 232px;
  overflow-y: auto;
  padding-right: 4px;
  margin-bottom: 12px;
}

.chat-msg {
  font-size: 13px;
  line-height: 1.6;
  word-break: break-word;
}

.chat-msg .who {
  font-weight: 600;
  margin-right: 6px;
}

.chat-msg.is-system {
  font-size: 12px;
  color: var(--ink-3);
}

.chat-msg.is-mine .who {
  color: var(--brand-deep);
}

.chat-input {
  display: flex;
  gap: 8px;
}

.field {
  flex: 0 1 auto;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

/* 聊天输入框需要撑满剩余宽度 */
.chat-input .field {
  flex: 1 1 auto;
  min-width: 0;
}

.field:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(217, 119, 87, 0.12);
}

.field::placeholder {
  color: #b8b3a8;
}

/* ============================================================
   对局区
   ============================================================ */

.play-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 28px;
  align-items: start;
}

.board-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 26px;
}

.board-canvas {
  display: block;
  width: 560px;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  border-radius: var(--radius-sm);
  background: #f2ece2;
  touch-action: manipulation;
  cursor: pointer;
}

.board-canvas.is-locked {
  cursor: default;
}

.turn-banner {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--brand-softer);
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-deep);
}

.turn-banner .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
}

.turn-banner .dot.is-white {
  background: #fff;
  box-shadow: inset 0 0 0 1px #cfcbc2;
}

.turn-banner .dot.is-black {
  background: var(--ink);
}

.score-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.score-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 12px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fdfcfa;
  font-size: 13px;
  transition: border-color .18s, background .18s, box-shadow .18s;
}

/* 行与行之间的引导：细虚线 + 小箭头，把「谁接谁」连起来 */
.score-row + .score-row::before {
  content: '';
  position: absolute;
  left: 23px;
  top: -20px;
  width: 1px;
  height: 20px;
  background: repeating-linear-gradient(
    to bottom,
    var(--line-strong, #D9D4C8) 0 3px,
    transparent 3px 6px
  );
}

.score-row + .score-row::after {
  content: '';
  position: absolute;
  left: 20px;
  top: -8px;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--line-strong, #D9D4C8);
  border-bottom: 1.5px solid var(--line-strong, #D9D4C8);
  transform: rotate(45deg);
  opacity: .75;
}

/* 序号徽章：一眼看出这是第几个行动 */
.turn-badge {
  flex: 0 0 auto;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
  background: #F1EEE7;
  border: 1px solid var(--line);
  transition: background .18s, color .18s, border-color .18s, transform .18s;
}

/* 轮到谁：描边 + 光晕呼吸 + 左滑入的高亮条 */
.score-row.is-turn {
  border-color: var(--brand);
  background: var(--brand-softer);
  box-shadow: inset 3px 0 0 var(--brand), 0 0 0 3px rgba(217, 119, 87, .10);
  animation: turnGlow 1.8s ease-in-out infinite;
}

.score-row.is-turn .turn-badge {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  transform: scale(1.06);
}

.score-row.is-turn .score-name {
  color: var(--brand-ink, #8C3F22);
}

/* 下一个是谁：虚线框，只提示不抢戏 */
.score-row.is-next {
  border-style: dashed;
}

.score-row.is-next .turn-badge {
  background: transparent;
  color: var(--ink-3);
}

.turn-now {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px 2px 6px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
}

.turn-now i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #fff;
  animation: turnBlink 1.1s ease-in-out infinite;
}

@keyframes turnGlow {
  0%, 100% { box-shadow: inset 3px 0 0 var(--brand), 0 0 0 3px rgba(217, 119, 87, .08); }
  50%      { box-shadow: inset 3px 0 0 var(--brand), 0 0 0 6px rgba(217, 119, 87, .16); }
}

@keyframes turnBlink {
  0%, 100% { opacity: 1; }
  50%      { opacity: .25; }
}

@media (prefers-reduced-motion: reduce) {
  .score-row.is-turn { animation: none; }
  .turn-now i { animation: none; }
}

.score-row.is-active {
  border-color: var(--brand);
  background: var(--brand-softer);
}

.score-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.score-name {
  font-weight: 600;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-tag {
  font-size: 11px;
  color: var(--ink-3);
}

.result-banner {
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--brand-softer);
  border: 1px solid var(--brand-soft);
  text-align: center;
}

.result-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--brand-deep);
}

.result-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--ink-2);
}

/* ============================================================
   斗地主
   ============================================================ */

.ll-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px;
  min-height: 620px;
}

/* --- 对手区 --- */

.ll-opponents {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.ll-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 108px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fdfcfa;
  transition: border-color 0.15s, background 0.15s;
}

.ll-player.is-active {
  border-color: var(--brand);
  background: var(--brand-softer);
}

.ll-player.is-landlord {
  border-color: var(--brand-soft);
  background: var(--brand-softer);
}

.ll-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
}

.ll-player.is-landlord .ll-avatar {
  background: var(--brand);
}

.ll-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ll-role {
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--line-soft);
  color: var(--ink-2);
}

.ll-role.is-landlord {
  background: var(--brand);
  color: #fff;
}

.ll-count {
  font-size: 11px;
  color: var(--ink-3);
}

.ll-count b {
  font-size: 15px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* --- 底牌 --- */

.ll-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  flex: 1;
}

.ll-bottom-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.ll-bottom-cards {
  display: flex;
  gap: 6px;
}

/* --- 桌面出牌区 --- */

.ll-table {
  flex: 1;
  min-height: 168px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: #fbfaf7;
}

.ll-table-label {
  font-size: 12px;
  color: var(--ink-3);
  transition: color 0.15s;
}

.ll-table-label.is-result {
  font-size: 18px;
  font-weight: 700;
  color: var(--brand-deep);
  letter-spacing: -0.01em;
}

.ll-result {
  text-align: center;
  font-size: 12px;
  color: var(--ink-3);
  padding: 4px 0 2px;
}

.ll-table-cards {
  display: flex;
  gap: 6px;
  min-height: 84px;
  align-items: center;
}

/* --- 我这边 --- */

.ll-me-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ll-turn {
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-deep);
}

.ll-turn.is-idle {
  color: var(--ink-3);
  font-weight: 500;
}

.ll-mult {
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.ll-hand {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  min-height: 108px;
  padding: 18px 0 4px;
  overflow-x: auto;
  overflow-y: hidden;
}

.ll-hand .pcard {
  margin-left: calc(var(--overlap, 18px) * -1);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.ll-hand .pcard:first-child {
  margin-left: 0;
}

.ll-hand .pcard.is-picked {
  transform: translateY(-16px);
  box-shadow: 0 6px 14px rgba(28, 27, 25, 0.16);
  border-color: var(--brand);
}

.ll-hand .pcard:hover {
  transform: translateY(-8px);
}

.ll-hand .pcard.is-picked:hover {
  transform: translateY(-20px);
}

/* --- 牌 --- */

.pcard {
  position: relative;
  width: 54px;
  height: 78px;
  flex-shrink: 0;
  border: 1px solid #d8d3c8;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 5px 0 0 5px;
  box-shadow: 0 1px 2px rgba(28, 27, 25, 0.07);
  user-select: none;
  cursor: pointer;
}

/* 点数 + 花色横排在左上，保证手牌重叠时仍可读 */
.pcard-top {
  display: flex;
  align-items: baseline;
  gap: 1px;
  line-height: 1;
}

.pcard.is-red {
  color: #c0503a;
}

.pcard.is-static {
  cursor: default;
}

.pcard-rank {
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}

.pcard-suit {
  font-size: 11px;
  line-height: 1;
}

.pcard-big {
  position: absolute;
  right: 6px;
  bottom: 5px;
  font-size: 20px;
  line-height: 1;
  opacity: 0.85;
}

.pcard.is-joker .pcard-rank {
  font-size: 12px;
  writing-mode: vertical-rl;
  letter-spacing: 0.08em;
  margin-top: 4px;
}

/* 小牌：对手出牌 / 底牌 / 桌面 */
.pcard-sm {
  width: 42px;
  height: 60px;
  border-radius: 6px;
  padding-top: 4px;
}

.pcard-sm .pcard-rank {
  font-size: 13px;
}

.pcard-sm .pcard-suit {
  font-size: 9px;
}

.pcard-sm .pcard-big {
  font-size: 14px;
  right: 4px;
  bottom: 3px;
}

.pcard-sm.is-joker .pcard-rank {
  font-size: 9px;
}

/* 底牌背面 */
.pcard-back {
  background:
    repeating-linear-gradient(45deg, #efe7dc 0 6px, #e6dccd 6px 12px);
  border-color: #ddd4c5;
}

/* --- 叫地主 --- */

.ll-bid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-radius: var(--radius);
  background: var(--brand-softer);
  border: 1px solid var(--brand-soft);
}

.ll-bid-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-deep);
}

.ll-bid-btns,
.ll-actions {
  display: flex;
  gap: 10px;
}

.ll-actions {
  justify-content: center;
  padding-top: 2px;
}

.ll-actions .btn {
  min-width: 96px;
}


/* ============================================================
   Toast
   ============================================================ */

.toast-host {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.toast {
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 6px 24px rgba(28, 27, 25, 0.18);
  animation: toast-in 0.2s ease;
}

.toast.is-error {
  background: #b4462f;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================
   连接状态
   ============================================================ */

.conn-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-3);
}

.conn-dot i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #c8c3b8;
  display: block;
}

.conn-dot.is-online i {
  background: var(--ok);
}

.conn-dot.is-offline i {
  background: #b4462f;
}

/* ============================================================
   响应式
   ============================================================ */

@media (max-width: 1080px) {
  .game-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .room-layout,
  .play-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 780px) {
  .topbar {
    padding: 0 16px;
  }

  .page {
    padding: 24px 16px 56px;
  }

  .hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 24px;
  }

  .hero-title {
    font-size: 32px;
  }

  .hero-stats {
    gap: 28px;
  }

  .game-grid {
    grid-template-columns: minmax(0, 1fr);
  }

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

  .nav {
    display: none;
  }

  .seat {
    min-height: 156px;
    padding: 16px 12px;
  }
}

/* ============================================================
   你画我猜 · 接力
   ============================================================ */

.dw-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
}

.dw-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}

.dw-who {
  flex: 1;
  text-align: center;
}

.dw-bar.is-me .dw-who {
  color: var(--brand);
  font-weight: 600;
}

.dw-timer {
  font-family: var(--mono);
  font-size: 12px;
  min-width: 34px;
  text-align: right;
}

.dw-timer.is-low {
  color: var(--brand);
}

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

.dw-lead {
  font-size: 13px;
  color: var(--ink-2);
  margin: 0;
}

.dw-words {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.dw-word {
  padding: 26px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, transform 0.15s;
}

.dw-word:hover {
  border-color: var(--brand);
  color: var(--brand);
  transform: translateY(-1px);
}

.dw-word:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
}

.dw-title {
  font-size: 15px;
  font-weight: 600;
}

.dw-pad {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}

.dw-canvas {
  display: block;
  width: 100%;
  height: auto;
  cursor: crosshair;
  touch-action: none;
}

.dw-pad-preview {
  width: 100%;
  max-width: 460px;
  align-self: center;
}

.dw-pad-preview .dw-canvas {
  cursor: default;
}

.dw-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.dw-palette,
.dw-sizes {
  display: flex;
  gap: 6px;
  align-items: center;
}

.dw-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--line);
  cursor: pointer;
  padding: 0;
}

.dw-swatch.is-on {
  box-shadow: 0 0 0 2px var(--ink);
}

.dw-size {
  width: 32px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
}

.dw-size.is-on {
  border-color: var(--ink);
  color: var(--ink);
  font-weight: 600;
}

.dw-label-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dw-label-row.is-stacked {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.dw-label-row.is-stacked .field {
  width: 100%;
  padding: 11px 14px;
  font-size: 15px;
}

.dw-label {
  font-size: 13px;
  color: var(--ink-2);
  white-space: nowrap;
}

.dw-hint {
  margin: 0;
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.6;
}

.dw-wait {
  align-items: center;
  justify-content: center;
  padding: 84px 0;
  gap: 6px;
  text-align: center;
}

.dw-wait-title {
  font-size: 16px;
  font-weight: 600;
}

.dw-wait-sub {
  font-size: 13px;
  color: var(--ink-3);
}

.dw-prompt {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.dw-prompt-label {
  font-size: 12px;
  color: var(--ink-3);
}

.dw-prompt-word {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

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

.dw-round-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dw-round-label {
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.06em;
}

.dw-chain-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.dw-cell {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.dw-cell-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
  color: var(--ink-3);
}

.dw-cell-who {
  font-weight: 600;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dw-cell-flag {
  color: var(--brand);
}

.dw-mini {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
}

.dw-cell-text {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: 6px;
  background: var(--brand-softer);
  font-size: 15px;
  font-weight: 600;
  text-align: center;
}

.dw-cell-label {
  font-size: 11px;
  color: var(--ink-3);
  text-align: center;
}

.dw-stars {
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 6px 0 2px;
}

.dw-star {
  border: none;
  background: none;
  padding: 0 2px;
  font-size: 34px;
  line-height: 1;
  color: var(--line);
  cursor: pointer;
  transition: color 0.12s, transform 0.12s;
}

.dw-star:hover:not(.is-disabled),
.dw-star.is-picked {
  color: var(--brand);
  transform: translateY(-1px);
}

.dw-star.is-disabled {
  cursor: default;
  opacity: 0.45;
}

.dw-board {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dw-rank {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 13px 16px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: #fff;
  font-size: 13px;
}

.dw-rank.is-win {
  border-color: var(--brand);
  background: var(--brand-softer);
}

.dw-rank-no {
  font-family: var(--mono);
  color: var(--ink-3);
}

.dw-rank-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dw-rank-detail {
  font-size: 11px;
  color: var(--ink-3);
}

.dw-rank-score {
  font-family: var(--mono);
  font-weight: 600;
}

.dw-opt-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}

.dw-opt-title {
  font-size: 14px;
  font-weight: 600;
}

.dw-opt-note {
  font-size: 11px;
  color: var(--ink-3);
}

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

.dw-mode {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.dw-mode.is-on {
  border-color: var(--brand);
  background: var(--brand-softer);
}

.dw-mode:disabled {
  cursor: default;
}

.dw-mode-name {
  font-size: 13px;
  font-weight: 600;
}

.dw-mode-desc {
  font-size: 11px;
  line-height: 1.45;
  color: var(--ink-3);
}

.dw-opt-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
}

.dw-opt-label {
  font-size: 12px;
  color: var(--ink-2);
  margin-right: 4px;
}

.dw-round {
  width: 30px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
}

.dw-round.is-on {
  border-color: var(--ink);
  color: var(--ink);
  font-weight: 600;
}

@media (max-width: 720px) {
  .dw-wrap {
    padding: 14px;
  }

  .dw-words,
  .dw-modes {
    grid-template-columns: minmax(0, 1fr);
  }

  .dw-word {
    padding: 16px 8px;
  }
}

/* ============================================================
   UNO
   ============================================================ */

.uno-wrap {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  padding: 20px;
  min-height: 560px;
}

.uno-bottom {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ---------------------------------------------------------- 对手区 */

.uno-opponents {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 6px;
  padding: 4px 0 2px;
  min-height: 132px;
}

/* 座位之间的方向箭头：顺时针还是逆时针，扫一眼就知道 */
.uno-flow {
  flex: 0 0 auto;
  padding-bottom: 40px;
  color: var(--ink-3);
  font-size: 22px;
  line-height: 1;
  opacity: 0.5;
  transition: opacity 0.2s;
}

.uno-flow.is-rev {
  transform: scaleX(-1);
}

.uno-player {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 12px 10px;
  border: 1px solid transparent;
  border-radius: 14px;
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
}

.uno-player.is-turn {
  border-color: var(--brand-soft);
  background: #fff;
  box-shadow: 0 6px 20px rgba(217, 119, 87, 0.14);
}

.uno-player-head {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 130px;
}

.uno-player-name {
  font-size: 12px;
  color: var(--ink-2);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.uno-player.is-turn .uno-player-name {
  color: var(--brand);
}

.uno-player-count {
  flex: 0 0 auto;
  min-width: 20px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #F1EEE7;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
}

.uno-player.is-turn .uno-player-count {
  background: var(--brand);
  color: #fff;
}

/* 实体牌背：小牌一张张排开，边界清楚才数得出来 */
.uno-fan {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  width: 182px;
}

.uno-fan .uno-back.is-mini {
  position: relative;
  width: 22px;
  height: 32px;
  border-radius: 4px;
  margin: 0;
  box-shadow: 0 1px 2px rgba(28, 27, 25, 0.26);
}

.uno-fan .uno-back.is-mini .uno-back-dot {
  width: 8px;
  height: 8px;
  box-shadow: none;
}

.uno-fan-more {
  position: absolute;
  right: -6px;
  bottom: -4px;
  padding: 1px 5px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-family: var(--mono);
  font-size: 10px;
}

.uno-uno-badge {
  position: absolute;
  top: -9px;
  right: 2px;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

/* 轮到谁：头顶一支往下指的箭头 */
.uno-turn-arrow {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  animation: unoBob 1.2s ease-in-out infinite;
}

.uno-turn-arrow-text {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.uno-turn-arrow-tip {
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid var(--brand);
}

@keyframes unoBob {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%      { transform: translateX(-50%) translateY(5px); }
}

/* 自己回合的箭头：贴在手牌上方 */
.uno-myarrow {
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  animation: unoBobSelf 1.2s ease-in-out infinite;
}

.uno-myarrow[hidden] {
  display: none;
}

.uno-myarrow .uno-turn-arrow-text {
  background: var(--brand);
}

@keyframes unoBobSelf {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(5px); }
}

/* ---------------------------------------------------------- 桌面 */

.uno-table {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 20px 8px;
  min-height: 300px;
}

/* 中间一块浅色台面，把牌堆和弃牌堆托起来 */
.uno-table::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 22px;
  background: radial-gradient(120% 90% at 50% 38%, #fcfaf6 0%, #f3f0e9 100%);
  border: 1px solid var(--line-soft);
}

.uno-center {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.uno-piles {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
}

.uno-deck {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.uno-deck.is-disabled {
  cursor: default;
  opacity: 0.62;
}

.uno-deck-stack {
  position: relative;
  width: 66px;
  height: 100px;
}

.uno-deck-stack .uno-card {
  position: absolute;
  left: 0;
  top: 0;
}

.uno-deck-label {
  margin-top: 2px;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  color: var(--ink-2);
  font-family: var(--mono);
}

.uno-pile {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 118px;
  height: 158px;
  border-radius: 14px;
  border: 1px dashed var(--line);
  background: rgba(255, 255, 255, 0.5);
}

.uno-status {
  padding: 6px 14px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-2);
  box-shadow: var(--shadow);
}

.uno-status.is-mine {
  border-color: var(--brand);
  color: var(--brand-ink);
  background: var(--brand-softer);
  font-weight: 600;
}

.uno-color-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 11px;
  color: var(--ink-2);
}

.uno-color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--line);
}

.uno-color-dot.is-red { background: #C8452F; }
.uno-color-dot.is-yellow { background: #D9A521; }
.uno-color-dot.is-green { background: #3F7D5B; }
.uno-color-dot.is-blue { background: #2F5D8C; }

.uno-dir {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 11px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 11px;
  color: var(--ink-2);
}

.uno-dir-ico {
  font-size: 13px;
  color: var(--brand);
}

/* ---------------------------------------------------------- 牌面 */

.uno-card {
  width: 66px;
  height: 96px;
  border-radius: 10px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: #fff;
  box-shadow: 0 1px 2px rgba(28, 27, 25, 0.16);
  overflow: hidden;
  user-select: none;
}

.uno-card.is-red { background: #C8452F; }
.uno-card.is-green { background: #3F7D5B; }
.uno-card.is-blue { background: #2F5D8C; }
.uno-card.is-yellow { background: #D9A521; color: #40320A; }
.uno-card.is-wild { background: #1C1B19; }

.uno-face-center {
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.uno-card.is-wild .uno-face-center {
  font-size: 0;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: conic-gradient(
    #C8452F 0 25%,
    #D9A521 0 50%,
    #3F7D5B 0 75%,
    #2F5D8C 0
  );
}

/* 「全体跳过」「洗牌」这种用汉字的功能牌：保留文字，不要被万能牌的色轮规则吃掉 */
.uno-card.is-wordcard .uno-face-center {
  font-size: 15px;
  width: auto;
  height: auto;
  border-radius: 0;
  background: none;
  font-weight: 600;
  letter-spacing: 0;
}

.uno-face-tl,
.uno-face-br {
  position: absolute;
  font-size: 11px;
  font-weight: 700;
  opacity: 0.92;
}

.uno-card.is-wordcard .uno-face-tl,
.uno-card.is-wordcard .uno-face-br {
  font-size: 8px;
}

.uno-face-tl {
  top: 6px;
  left: 8px;
}

.uno-face-br {
  bottom: 6px;
  right: 8px;
  transform: rotate(180deg);
}

.uno-back {
  background: #1C1B19;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(28, 27, 25, 0.18), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.uno-back-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.14);
}

.uno-back.is-under {
  background: #2B2926;
  transform: rotate(-9deg) translate(-7px, 4px);
}

.uno-back.is-under2 {
  background: #232120;
  transform: rotate(7deg) translate(6px, 1px);
}

.uno-card.is-table {
  width: 88px;
  height: 126px;
  box-shadow: 0 6px 18px rgba(28, 27, 25, 0.22);
  animation: unoDrop 0.26s ease-out;
}

.uno-card.is-table .uno-face-center {
  font-size: 32px;
}

.uno-card.is-table.is-wordcard .uno-face-center {
  font-size: 19px;
}

/* 出牌动线：一张牌从出牌者飞到弃牌堆 */
.uno-card.is-flying {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: transform 0.42s cubic-bezier(0.3, 0.8, 0.4, 1), opacity 0.42s ease-in;
  box-shadow: 0 10px 26px rgba(28, 27, 25, 0.3);
}

@keyframes unoDrop {
  from { transform: translateY(-10px) scale(0.94); opacity: 0.5; }
  to { transform: none; opacity: 1; }
}

/* ---------------------------------------------------------- 手牌 */

.uno-hand-meta {
  font-size: 12px;
  color: var(--ink-2);
  letter-spacing: 0.03em;
  padding: 0 2px;
}

.uno-hand {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-height: 104px;
  padding: 8px 2px 2px;
  overflow: hidden;
}

.uno-hand .uno-card {
  flex: 0 0 auto;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

/* 白色内圈把品牌色描边和牌面隔开：红牌上纯品牌色描边几乎看不见 */
.uno-hand .uno-card.is-playable {
  transform: translateY(-7px);
  box-shadow: 0 0 0 1px #fff, 0 0 0 3px var(--brand), 0 8px 16px rgba(28, 27, 25, 0.22);
}

.uno-hand .uno-card.is-playable:hover {
  transform: translateY(-12px);
}

.uno-hand .uno-card.is-dim {
  opacity: 0.7;
  cursor: default;
}

/* ---------------------------------------------------------- 操作 */

.uno-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  min-height: 0;
}

.uno-actions > [hidden] {
  display: none;
}

.uno-shout {
  animation: unoPulse 1.1s infinite;
}

@keyframes unoPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217, 119, 87, 0.45); }
  50% { box-shadow: 0 0 0 8px rgba(217, 119, 87, 0); }
}

/* ---------------------------------------------------------- 选色 */

.uno-picker {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(28, 27, 25, 0.36);
}

.uno-picker[hidden] {
  display: none;
}

.uno-picker-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 22px 24px 18px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(28, 27, 25, 0.22);
}

.uno-picker-title {
  font-size: 14px;
  font-weight: 600;
}

.uno-picker-row {
  display: flex;
  gap: 10px;
}

.uno-pick {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--line);
  cursor: pointer;
  transition: transform 0.12s;
}

.uno-pick:hover {
  transform: scale(1.08);
}

.uno-pick.is-red { background: #C8452F; }
.uno-pick.is-yellow { background: #D9A521; }
.uno-pick.is-green { background: #3F7D5B; }
.uno-pick.is-blue { background: #2F5D8C; }

/* ---------------------------------------------------------- 结算 */

.uno-result {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}

.uno-result[hidden] {
  display: none;
}

.uno-result-title {
  font-size: 16px;
  font-weight: 600;
}

.uno-result-sub {
  font-size: 12px;
  color: var(--ink-3);
}

.uno-score-board {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.uno-score-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  padding: 11px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: #fff;
  font-size: 13px;
}

.uno-score-row.is-win {
  border-color: var(--brand);
  background: var(--brand-softer);
}

.uno-score-cards {
  font-size: 11px;
  color: var(--ink-3);
}

.uno-score-points {
  font-family: var(--mono);
  font-weight: 600;
}

@media (max-width: 720px) {
  .uno-wrap {
    padding: 12px;
    min-height: 0;
    gap: 10px;
  }

  .uno-opponents {
    gap: 2px;
    min-height: 0;
    flex-wrap: wrap;
  }

  .uno-player {
    padding: 12px 8px 6px;
  }

  .uno-player-head {
    max-width: 92px;
  }

  .uno-fan {
    width: 138px;
    gap: 3px;
  }

  .uno-fan .uno-back.is-mini {
    width: 17px;
    height: 25px;
    border-radius: 3px;
  }

  .uno-flow {
    padding-bottom: 24px;
    font-size: 16px;
  }

  .uno-table {
    min-height: 210px;
    gap: 12px;
    padding: 14px 6px;
  }

  .uno-piles {
    gap: 18px;
  }

  .uno-pile {
    width: 96px;
    height: 132px;
  }

  .uno-card.is-table {
    width: 74px;
    height: 106px;
  }

  .uno-hand {
    min-height: 84px;
  }
}

/* ============================================================
   大厅 · 「你还在房间里」提示条
   ============================================================ */

.room-back {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius-sm);
  background: var(--brand-softer);
}

.room-back[hidden] {
  display: none;
}

.room-back-text {
  font-size: 13px;
  color: var(--ink-2);
}

.room-back-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ============================================================
   四子棋
   ============================================================ */

.c4-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px;
}

.c4-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 30px;
}

.c4-status {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
}

.c4-status.is-mine {
  color: var(--brand);
}

.c4-status.is-over {
  color: var(--ink);
}

.c4-head-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.c4-board {
  display: flex;
  justify-content: center;
}

.c4-grid {
  display: grid;
  grid-template-columns: repeat(7, 52px);
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(28, 27, 25, 0.05);
}

.c4-cell {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  transition: background 0.12s;
}

.c4-cell.is-clickable {
  cursor: pointer;
}

.c4-cell.is-hover {
  background: var(--brand-softer);
}

.c4-cell.is-blocked {
  background: #FBEEE9;
}

.c4-disc {
  display: block;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  transition: background 0.12s, box-shadow 0.12s;
}

.c4-disc.is-empty {
  background: #F4F1EA;
  box-shadow: inset 0 1px 2px rgba(28, 27, 25, 0.07);
}

.c4-disc.is-red {
  background: #C8452F;
  box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.16);
}

.c4-disc.is-yellow {
  background: #D9A521;
  box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.14);
}

.c4-cell.is-last .c4-disc {
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(28, 27, 25, 0.28);
}

.c4-cell.is-win .c4-disc {
  animation: c4Win 1.3s ease-in-out infinite;
}

@keyframes c4Win {
  /* 不要从 0 开始淡：截图/暂停在低点时会看不出哪四颗赢了 */
  0%, 100% { box-shadow: 0 0 0 3px rgba(217, 119, 87, 0.4); }
  50% { box-shadow: 0 0 0 5px rgba(217, 119, 87, 0.85); }
}

.c4-hint {
  margin: 0;
  text-align: center;
  font-size: 12px;
  color: var(--ink-3);
}

.c4-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}

.c4-result[hidden] {
  display: none;
}

.c4-result-title {
  font-size: 16px;
  font-weight: 600;
}

.c4-result-sub {
  font-size: 12px;
  color: var(--ink-3);
}

/* ============================================================
   记忆翻牌
   ============================================================ */

.mm-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 22px;
}

.mm-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.mm-status {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
}

.mm-status.is-mine {
  color: var(--brand);
}

.mm-status.is-over {
  color: var(--ink);
}

.mm-rest {
  font-size: 12px;
  color: var(--ink-3);
  font-family: var(--mono);
}

.mm-scores {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.mm-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 12px;
  color: var(--ink-2);
}

.mm-chip.is-turn {
  border-color: var(--brand);
  background: var(--brand-softer);
  color: var(--ink);
}

.mm-chip-name {
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mm-chip-n {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--ink);
}

.mm-grid {
  display: grid;
  grid-template-columns: repeat(4, 78px);
  gap: 10px;
  padding: 4px;
}

.mm-card {
  width: 78px;
  height: 96px;
  padding: 0;
  border: none;
  background: none;
  cursor: default;
  -webkit-tap-highlight-color: transparent;
}

.mm-card.is-clickable {
  cursor: pointer;
}

.mm-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
}

.mm-face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

/* 不用 rotateY：backface-visibility 在软件渲染环境里会失效，
   正反面会一起露出来或被整面裁掉。改成「背面淡出 + 正面淡入」的翻牌，
   观感接近，但任何环境都不会画错。 */
.mm-back {
  background: #1C1B19;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1), 0 1px 2px rgba(28, 27, 25, 0.16);
}

.mm-card.is-open .mm-back {
  opacity: 0;
  transform: scale(0.92);
  pointer-events: none;
}

.mm-card.is-clickable:hover .mm-back {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22), 0 3px 9px rgba(28, 27, 25, 0.22);
}

.mm-back-mark {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--brand);
  opacity: 0.9;
}

.mm-front {
  opacity: 0;
  transform: scale(0.92);
  pointer-events: none;
  background: #fff;
  border: 1px solid var(--line);
}

.mm-card.is-open .mm-front {
  opacity: 1;
  transform: none;
}

.mm-symbol {
  font-size: 34px;
  line-height: 1;
}

.mm-front.tone-0 .mm-symbol { color: #C8452F; }
.mm-front.tone-1 .mm-symbol { color: #C99A0E; }
.mm-front.tone-2 .mm-symbol { color: #3F7D5B; }
.mm-front.tone-3 .mm-symbol { color: #2F5D8C; }
.mm-front.tone-4 .mm-symbol { color: #7A4E8C; }
.mm-front.tone-5 .mm-symbol { color: #B0603A; }
.mm-front.tone-6 .mm-symbol { color: #1C1B19; }
.mm-front.tone-7 .mm-symbol { color: #4F8A6D; }

.mm-card.is-matched .mm-front {
  background: var(--brand-softer);
  border-color: rgba(217, 119, 87, 0.5);
}

.mm-card.is-matched .mm-symbol {
  opacity: 0.5;
}

.mm-hint {
  margin: 0;
  text-align: center;
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.6;
}

.mm-result {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  max-width: 360px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}

.mm-result[hidden] {
  display: none;
}

.mm-rank {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: #fff;
  font-size: 13px;
}

.mm-rank.is-win {
  border-color: var(--brand);
  background: var(--brand-softer);
}

.mm-rank-name {
  font-weight: 600;
}

.mm-rank-n {
  font-family: var(--mono);
  color: var(--ink-2);
}

.mm-result .btn {
  align-self: flex-start;
  margin-top: 6px;
}

@media (max-width: 720px) {
  .c4-wrap,
  .mm-wrap {
    padding: 14px;
  }

  .c4-grid {
    grid-template-columns: repeat(7, 38px);
    gap: 5px;
    padding: 10px;
  }

  .c4-cell {
    width: 38px;
    height: 38px;
    border-radius: 9px;
  }

  .c4-disc {
    width: 31px;
    height: 31px;
  }

  .mm-grid {
    grid-template-columns: repeat(4, 66px);
    gap: 8px;
  }

  .mm-card {
    width: 66px;
    height: 82px;
  }

  .mm-symbol {
    font-size: 28px;
  }
}

/* ============================================================
   黑白棋
   ============================================================ */

.rv-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px;
}

.rv-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.rv-status {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.rv-status.is-mine {
  color: var(--brand-deep);
}

.rv-status.is-over {
  color: var(--ink);
}

.rv-score {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 470px;
}

.rv-score-side {
  display: flex;
  align-items: center;
  gap: 6px;
}

.rv-score-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  display: block;
}

.rv-score-dot.is-black {
  background: #1c1b19;
}

.rv-score-dot.is-white {
  background: #fff;
  box-shadow: inset 0 0 0 1px #cfc5b4;
}

.rv-score-num {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}

.rv-score-bar {
  flex: 1;
  display: flex;
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--line-soft);
}

.rv-score-fill {
  height: 100%;
  transition: flex-grow 0.35s ease;
}

.rv-score-fill.is-black {
  background: #1c1b19;
}

.rv-score-fill.is-white {
  background: #c9c2b2;
}

.rv-board {
  display: grid;
  grid-template-columns: repeat(8, 52px);
  /* 2px 而不是 1px：1px 的格线在缩放/高分屏下会糊掉，看起来像棋盘没画格 */
  gap: 2px;
  padding: 7px;
  background: #2e5240;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
}

.rv-cell {
  position: relative;
  width: 52px;
  height: 52px;
  padding: 0;
  border: none;
  background: #3e6b4f;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  -webkit-tap-highlight-color: transparent;
}

.rv-cell.is-clickable {
  cursor: pointer;
}

.rv-disc {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: block;
  transition: background-color 0.2s ease, box-shadow 0.2s ease, opacity 0.25s ease;
}

.rv-disc.is-empty {
  background: transparent;
}

.rv-disc.is-black {
  background: radial-gradient(circle at 34% 30%, #3d3a35 0%, #1c1b19 62%);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.rv-disc.is-white {
  background: radial-gradient(circle at 34% 30%, #ffffff 0%, #efece4 68%);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
}

/* 合法点：小圆点，颜色跟着当前执子方走 */
.rv-cell.is-legal::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.62);
}

.rv-board.is-white-turn .rv-cell.is-legal::after {
  background: rgba(255, 255, 255, 0.72);
}

.rv-board:not(.is-white-turn) .rv-cell.is-legal::after {
  background: rgba(20, 18, 15, 0.5);
}

.rv-cell.is-clickable:hover::after {
  transform: scale(1.25);
}

.rv-cell.is-last::before {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  border: 2px solid var(--brand);
  opacity: 0.9;
}

@keyframes rvFlip {
  0% { transform: rotateY(0deg) scale(1); }
  48% { transform: rotateY(88deg) scale(0.82); }
  100% { transform: rotateY(0deg) scale(1); }
}

.rv-cell.is-flip .rv-disc {
  animation: rvFlip 0.42s cubic-bezier(0.34, 1.16, 0.64, 1);
}

.rv-hint {
  margin: 0;
  font-size: 12px;
  color: var(--ink-3);
  text-align: center;
  max-width: 470px;
}

.rv-result {
  width: 100%;
  max-width: 470px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}

.rv-result-title {
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.rv-result-sub {
  font-size: 12px;
  color: var(--ink-3);
  font-family: var(--mono);
}

.rv-result .btn {
  margin-top: 6px;
}

/* ============================================================
   大话骰
   ============================================================ */

.lr-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px;
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
}

.lr-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.lr-status {
  font-size: 15px;
  font-weight: 600;
}

.lr-status.is-mine {
  color: var(--brand-deep);
}

.lr-status.is-over {
  color: var(--ink);
}

.lr-round {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 9px;
}

.lr-head-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lr-timer {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  min-width: 26px;
  text-align: right;
}

.lr-timer.is-urgent {
  color: var(--brand-deep);
  font-weight: 600;
}

.lr-opponents {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lr-opp {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 2px;
  border-bottom: 1px dashed var(--line-soft);
  font-size: 13px;
  color: var(--ink-3);
}

.lr-opp.is-active {
  color: var(--ink);
}

.lr-opp.is-active .lr-opp-name {
  color: var(--brand-deep);
  font-weight: 600;
}

.lr-opp.is-out {
  opacity: 0.42;
  text-decoration: line-through;
}

.lr-opp-name {
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lr-opp-dice {
  display: flex;
  align-items: center;
  gap: 3px;
}

.lr-opp-die {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--ink);
  display: block;
}

.lr-opp-empty {
  font-size: 11px;
  color: var(--ink-3);
}

.lr-opp-tag {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--brand-deep);
}

.lr-bid-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 14px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.lr-bid-box.has-bid {
  border-color: rgba(217, 119, 87, 0.5);
  background: var(--brand-softer);
}

.lr-bid-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-3);
}

.lr-bid-main {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.lr-bid-num {
  font-variant-numeric: tabular-nums;
}

.lr-bid-empty {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-3);
}

.lr-bid-by {
  font-size: 12px;
  color: var(--ink-3);
}

/* 骰子点阵 */
.lr-pip {
  display: inline-grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 5px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: 0 1px 2px rgba(28, 27, 25, 0.05);
  vertical-align: middle;
}

.lr-pip-cell {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  display: block;
}

.lr-pip-cell.is-on {
  background: var(--ink);
}

.lr-pip.is-big {
  width: 44px;
  height: 44px;
  padding: 7px;
  border-radius: 9px;
}

.lr-pip.is-big .lr-pip-cell {
  width: 6px;
  height: 6px;
}

.lr-pip.is-mine {
  width: 46px;
  height: 46px;
  padding: 8px;
  border-radius: 9px;
  box-shadow: 0 2px 6px rgba(28, 27, 25, 0.1);
}

.lr-pip.is-mine .lr-pip-cell {
  width: 6px;
  height: 6px;
}

.lr-pip.is-small {
  width: 24px;
  height: 24px;
  padding: 3px;
  border-radius: 5px;
}

.lr-pip.is-small .lr-pip-cell {
  width: 3px;
  height: 3px;
}

.lr-mine {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lr-mine.is-out {
  opacity: 0.5;
}

.lr-mine-label {
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}

.lr-dice {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.lr-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.lr-controls.is-idle {
  opacity: 0.66;
}

.lr-qty-row,
.lr-faces {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.lr-ctrl-label {
  font-size: 12px;
  color: var(--ink-3);
  width: 34px;
  flex: none;
}

.lr-step {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.lr-step:hover:not(:disabled) {
  border-color: var(--ink-3);
}

.lr-step:disabled {
  opacity: 0.35;
  cursor: default;
}

.lr-qty-num {
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 600;
  min-width: 26px;
  text-align: center;
}

.lr-face {
  padding: 0;
  border: 1px solid transparent;
  background: none;
  border-radius: 9px;
  cursor: pointer;
  line-height: 0;
}

.lr-face:hover:not(:disabled) {
  border-color: var(--line);
}

.lr-face.is-on {
  border-color: var(--brand);
  background: var(--brand-softer);
}

.lr-face:disabled {
  opacity: 0.55;
  cursor: default;
}

.lr-actions {
  display: flex;
  gap: 8px;
}

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

.lr-ctrl-hint {
  margin: 0;
  font-size: 12px;
  color: var(--ink-3);
  min-height: 18px;
  line-height: 1.5;
}

.lr-history {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.lr-chip {
  font-size: 11px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-3);
}

.lr-chip.is-current {
  border-color: var(--brand);
  color: var(--ink);
}

.lr-reveal {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.lr-reveal.is-success {
  border-color: rgba(79, 138, 109, 0.45);
  background: var(--ok-soft);
}

.lr-reveal-title {
  font-size: 13px;
  font-weight: 600;
}

.lr-reveal-sub {
  font-size: 12px;
  color: var(--ink-2);
}

.lr-reveal-faces {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lr-reveal-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
}

.lr-reveal-row.is-lost {
  background: rgba(217, 119, 87, 0.12);
}

.lr-reveal-name {
  width: 58px;
  flex: none;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lr-reveal-dice {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.lr-reveal-tag {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--brand-deep);
}

.lr-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}

.lr-result-title {
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.lr-result-sub {
  font-size: 12px;
  color: var(--ink-3);
  font-family: var(--mono);
}

.lr-result .btn {
  margin-top: 6px;
}

@media (max-width: 720px) {
  .rv-wrap,
  .lr-wrap {
    padding: 14px;
  }

  .rv-board {
    grid-template-columns: repeat(8, 36px);
    padding: 5px;
  }

  .rv-cell {
    width: 36px;
    height: 36px;
  }

  .rv-disc {
    width: 27px;
    height: 27px;
  }

  .rv-cell.is-legal::after {
    width: 10px;
    height: 10px;
  }

  .lr-pip {
    width: 29px;
    height: 29px;
    padding: 4px;
  }

  .lr-pip.is-mine {
    width: 38px;
    height: 38px;
    padding: 6px;
  }

  .lr-pip.is-big {
    width: 38px;
    height: 38px;
    padding: 6px;
  }
}

/* ============================================================
   通用浮层：强制起名 / 移动端置顶
   ============================================================ */

.name-gate {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(28, 27, 25, 0.42);
  backdrop-filter: blur(2px);
}

.name-gate-card {
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 24px 24px 20px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(28, 27, 25, 0.26);
}

.name-gate-badge {
  align-self: flex-start;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-size: 11px;
  font-weight: 600;
}

.name-gate-title {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.name-gate-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-2);
}

.name-gate-form {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.name-gate-form .field {
  flex: 1;
  min-width: 0;
}

.name-gate-tip {
  min-height: 16px;
  font-size: 12px;
  color: var(--ink-3);
}

.name-gate-tip.is-error {
  color: #b3402c;
}

/* 手机上所有浮层都贴顶：底部有键盘、有操作条，居中会被挡住 */
@media (max-width: 720px) {
  .name-gate {
    align-items: flex-start;
    padding: 12px;
  }

  .name-gate-card {
    padding: 18px 16px 16px;
  }

  .name-gate-form {
    flex-direction: column;
  }

  .uno-picker {
    align-items: flex-start;
    padding: 12px;
  }

  .uno-picker-box {
    width: 100%;
    padding: 16px 14px 14px;
  }
}

/* ---------------------------------------------------------- 确认弹窗 */

.ask-gate {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(28, 27, 25, 0.42);
  backdrop-filter: blur(2px);
  animation: askFade 0.16s ease-out;
}

.ask-gate-card {
  width: min(360px, 100%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 22px 22px 18px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(28, 27, 25, 0.26);
  animation: askRise 0.2s cubic-bezier(0.3, 0.9, 0.4, 1);
}

.ask-gate-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: -0.01em;
}

.ask-gate-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-2);
}

.ask-gate-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.ask-gate-actions .btn {
  flex: 1;
  min-width: 0;
}

@keyframes askFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes askRise {
  from { transform: translateY(8px) scale(0.98); opacity: 0; }
  to { transform: none; opacity: 1; }
}

@media (max-width: 720px) {
  .ask-gate {
    align-items: flex-start;
    padding: 12px;
  }

  .ask-gate-card {
    padding: 18px 16px 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ask-gate,
  .ask-gate-card {
    animation: none;
  }
}

/* ============================================================
   窄屏：先把「谁在行动」提到最前，再是棋盘，最后聊天
   ============================================================ */

@media (max-width: 1080px) {
  /* 网格子项默认 min-width:auto，里面的横向内容会把整页撑宽（手机出现左右滑动） */
  .room-layout,
  .play-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .room-layout > *,
  .play-grid,
  .play-grid > *,
  .play-grid .panel,
  .score-list {
    min-width: 0;
  }

  .play-grid {
    display: flex;
    flex-direction: column;
    /* 基础样式是 align-items:start，竖排时会变成「面板宽度跟着内容走」，
       每个卡片宽窄不一 —— 必须拉回 stretch */
    align-items: stretch;
    gap: 14px;
  }

  /* 拆掉 aside 这层壳，「对局」提到棋盘前面，聊天沉到最后 */
  .play-grid > aside.stack {
    display: contents;
  }

  .play-grid > aside.stack > .panel:first-child {
    order: -1;
  }

  .play-grid > aside.stack > .panel:last-child {
    order: 1;
  }

  .play-grid > .panel {
    order: 0;
  }
}

/* ============================================================
   手机端：整体节奏
   ============================================================ */

@media (max-width: 780px) {
  .page {
    padding: 12px 12px 40px;
  }

  .panel-pad {
    padding: 14px;
  }

  .panel-head {
    margin-bottom: 12px;
  }

  /* 顶栏：一行装下，标题不折成竖排 */
  .topbar {
    gap: 8px;
    padding: 0 12px;
    height: 52px;
  }

  .topbar-left {
    flex: 1 1 auto;
    min-width: 0;
    gap: 6px;
    overflow: hidden;
  }

  .topbar-right {
    flex: 0 0 auto;
    gap: 6px;
  }

  .back-link {
    flex: 0 0 auto;
    padding: 6px 4px;
    white-space: nowrap;
  }

  .crumb {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .crumb-code {
    flex: 0 0 auto;
    font-size: 11px;
    padding: 2px 6px;
  }

  /* 窄屏只留小圆点，宽度让给标题 —— 顺带藏掉「复制邀请链接」的文字 */
  .conn-dot #connText {
    display: none;
  }

  #inviteBtn {
    padding: 6px 8px;
    font-size: 11px;
  }

  #leaveBtn {
    padding: 6px 8px;
    font-size: 11px;
  }

  /* ---------------- 行动顺序：4 个人也要一屏看全 ---------------- */

  .score-list {
    flex-direction: row;
    align-items: stretch;
    gap: 6px;
    padding: 2px;
  }

  .score-row {
    flex: 1 1 0;
    min-width: 0;
    flex-wrap: wrap;
    row-gap: 1px;
    column-gap: 4px;
    padding: 7px 5px 6px;
    border-radius: 10px;
  }

  /* 横排已经天然有先后，序号徽章和「行动中」胶囊都省掉，靠高亮说话 */
  .score-row .turn-badge,
  .score-row .turn-now {
    display: none;
  }

  .score-row .score-name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .score-row .score-tag {
    flex: 1 0 100%;
    font-size: 10px;
    color: var(--ink-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .score-row .score-dot {
    display: none;
  }

  /* 去掉行间连接线：横排不需要 */
  .score-row + .score-row::before,
  .score-row + .score-row::after {
    display: none;
  }

  #playActions {
    margin-top: 12px !important;
    flex-wrap: wrap;
  }

  #playActions .btn {
    flex: 1 1 0;
    min-width: 88px;
  }
}

/* ============================================================
   UNO · 桌面细节
   ============================================================ */

/* 牌堆是斜着叠的，堆高了会压住下面「牌堆 N」的标签 */
.uno-deck-stack {
  height: 116px;
}

.uno-deck-label {
  position: relative;
  z-index: 3;
  margin-top: 6px;
  background: #fff;
  border: 1px solid var(--line);
}

/* 方向箭头要看得见，不然「谁接谁」还是靠猜 */
.uno-flow {
  color: var(--brand);
  opacity: 0.8;
  font-size: 24px;
  font-weight: 700;
}

/* ============================================================
   UNO · 手机端
   ============================================================ */

@media (max-width: 780px) {
  .uno-wrap {
    padding: 12px;
    min-height: 0;
    gap: 10px;
  }

  /* ---------------- 对手：一律三列网格，不再绕成楼梯 ---------------- */

  .uno-opponents {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    align-items: start;
    gap: 6px;
    padding: 20px 0 2px;
    min-height: 0;
  }

  /* 方向已经在中栏「顺时针」上写着，箭头在窄屏只添乱 */
  .uno-flow {
    display: none;
  }

  .uno-player {
    gap: 5px;
    padding: 8px 2px 7px;
    border-radius: 10px;
  }

  .uno-player-head {
    max-width: 100%;
    gap: 4px;
  }

  .uno-player-name {
    font-size: 11px;
    max-width: 100%;
  }

  .uno-player-count {
    min-width: 16px;
    height: 15px;
    padding: 0 4px;
    border-radius: 8px;
    font-size: 10px;
    line-height: 15px;
  }

  /* 牌背缩到 13×19、间隙 2px：一行正好 7 张，超了折行也还数得清 */
  .uno-fan {
    width: 100%;
    gap: 2px;
    row-gap: 3px;
  }

  .uno-fan .uno-back.is-mini {
    width: 12px;
    height: 18px;
    border-radius: 2px;
    /* 一圈白边把连成一片的深色牌背切开，才数得出来是几张 */
    box-shadow: 0 0 0 1px #fff, 0 1px 2px rgba(28, 27, 25, 0.3);
  }

  .uno-fan .uno-back.is-mini .uno-back-dot {
    width: 5px;
    height: 5px;
  }

  .uno-fan-more {
    right: -2px;
    bottom: -6px;
    font-size: 9px;
  }

  .uno-turn-arrow {
    top: -17px;
    gap: 0;
  }

  .uno-turn-arrow-text {
    padding: 1px 7px;
    font-size: 9px;
  }

  .uno-turn-arrow-tip {
    border-left-width: 5px;
    border-right-width: 5px;
    border-top-width: 7px;
  }

  .uno-uno-badge {
    top: -7px;
    right: 0;
    font-size: 8px;
  }

  /* ---------------- 台面：牌堆 + 弃牌堆，留白给到两边 ---------------- */

  .uno-table {
    min-height: 168px;
    gap: 10px;
    padding: 12px 6px;
  }

  .uno-piles {
    gap: 22px;
  }

  .uno-deck-stack {
    width: 58px;
    height: 86px;
  }

  .uno-deck-stack .uno-card {
    width: 58px;
    height: 84px;
  }

  .uno-pile {
    width: 84px;
    height: 116px;
    border-radius: 11px;
  }

  .uno-card.is-table {
    width: 66px;
    height: 94px;
  }

  .uno-status {
    padding: 5px 12px;
    font-size: 12px;
  }

  /* ---------------- 手牌：留缝、能滑，别糊成一排 ---------------- */

  .uno-bottom {
    gap: 8px;
  }

  .uno-hand-meta {
    font-size: 11px;
  }

  .uno-hand {
    gap: 3px;
    min-height: 0;
    margin: 0 -6px;
    padding: 10px 6px 8px;
    /* 横滑容器必须左对齐，居中会让溢出的第一张滑不回去 */
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  .uno-hand::-webkit-scrollbar {
    display: none;
  }

  .uno-hand .uno-card {
    width: 44px;
    height: 64px;
    border-radius: 7px;
  }

  .uno-hand .uno-face-center,
  .uno-hand .uno-card.is-wordcard .uno-face-center {
    font-size: 17px;
  }

  .uno-hand .uno-card.is-wordcard .uno-face-center {
    font-size: 11px;
  }

  .uno-hand .uno-face-tl,
  .uno-hand .uno-face-br {
    font-size: 8px;
    top: 3px;
    left: 4px;
  }

  .uno-hand .uno-face-br {
    top: auto;
    left: auto;
    bottom: 3px;
    right: 4px;
  }

  .uno-hand .uno-card.is-wild .uno-face-center {
    width: 22px;
    height: 22px;
    border-radius: 6px;
  }

  /* 小牌上的角标字挤成一团，干脆省掉，只留中间的牌面 */
  .uno-hand .uno-card.is-wordcard .uno-face-tl,
  .uno-hand .uno-card.is-wordcard .uno-face-br {
    display: none;
  }

  .uno-hand .uno-card.is-playable {
    transform: translateY(-5px);
  }

  .uno-hand .uno-card.is-playable:hover {
    transform: translateY(-5px);
  }

  /* 手牌多到一行放不下时，右边缘渐隐：告诉人「还能往右滑」，而不是「牌被切了」 */
  .uno-hand.is-scroll {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent 100%);
    mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent 100%);
  }

  .uno-actions {
    gap: 6px;
  }
}

/* 手机端聊天区的滚动条收窄，别把气泡挤歪 */
@media (max-width: 780px) {
  .chat-log {
    scrollbar-width: thin;
  }

  .chat-log::-webkit-scrollbar {
    width: 4px;
  }

  .chat-log::-webkit-scrollbar-thumb {
    background: var(--line-strong);
    border-radius: 999px;
  }

  .chat-log::-webkit-scrollbar-track {
    background: transparent;
  }
}

/* 大厅顶栏：窄屏下昵称输入框别顶出屏幕 */
@media (max-width: 780px) {
  #nameInput {
    /* index.html 里是行内 width:132px，这里必须 !important 才盖得住 */
    width: 86px !important;
    padding: 0 8px;
  }

  .nav {
    gap: 10px;
    font-size: 13px;
  }

  .brand-sub {
    display: none;
  }

  .topbar {
    height: 56px;
  }
}

/* 手机端棋盘占满面板宽度：少留白，棋子才够大 */
@media (max-width: 780px) {
  .board-wrap {
    padding: 10px 10px 14px;
    gap: 12px;
  }
}

/* 邀请按钮：宽屏写全称，窄屏缩成「邀请」，别把「退出」挤出屏幕 */
.invite-short {
  display: none;
}

@media (max-width: 780px) {
  .invite-full {
    display: none;
  }

  .invite-short {
    display: inline;
  }
}

/* ============================================================
   手机端 · 斗地主
   ============================================================ */

@media (max-width: 780px) {
  .ll-wrap {
    padding: 12px;
    gap: 10px;
    min-height: 0;
  }

  /* 两家对手 + 底牌挤在一条：让对手卡自己分宽度，别用 min-width 硬撑 */
  .ll-opponents {
    gap: 8px;
    align-items: stretch;
  }

  .ll-player {
    flex: 1 1 0;
    min-width: 0;
    padding: 8px 6px;
    gap: 4px;
  }

  .ll-avatar {
    width: 34px;
    height: 34px;
    font-size: 13px;
  }

  .ll-name {
    max-width: 100%;
    font-size: 12px;
  }

  .ll-role {
    font-size: 10px;
    padding: 0 6px;
  }

  .ll-count {
    font-size: 10px;
  }

  .ll-count b {
    font-size: 13px;
  }

  .ll-bottom {
    flex: 0 0 auto;
    gap: 4px;
  }

  .ll-bottom-label {
    font-size: 10px;
  }

  .ll-bottom-cards .pcard-sm {
    width: 30px;
    height: 44px;
  }

  .ll-table {
    min-height: 132px;
  }

  .ll-hand {
    min-height: 0;
    padding: 16px 0 4px;
  }

  .ll-me-bar {
    gap: 8px;
  }
}
