/* ============================================================
   快玩（Play）全局样式
   由 app/Views/layout/header.php 与 install.php 统一引用
   ============================================================ */

/* 明确底色：亮色浅灰、暗色深墨，避免暗色下浅底 + 近白字看不清 */
html { color-scheme: light; background-color: #f6f7f9; }
html.dark { color-scheme: dark; background-color: #0b1220; }
body { background-color: #f6f7f9; }
html.dark body { background-color: #0b1220; }

/* 背景网格光晕 */
.bg-grid {
  background-image:
    radial-gradient(1100px 520px at 75% -10%, rgba(6,182,212,0.10), transparent 60%),
    radial-gradient(900px 500px at 8% 110%, rgba(124,58,237,0.08), transparent 60%);
}
html.dark .bg-grid {
  background-image:
    radial-gradient(1100px 560px at 75% -10%, rgba(34,211,238,0.10), transparent 60%),
    radial-gradient(900px 520px at 8% 110%, rgba(139,92,246,0.10), transparent 60%);
}

/* 玻璃卡片 */
.glass {
  background: rgba(255,255,255,0.78); border: 1px solid rgba(15,23,42,0.08);
  backdrop-filter: blur(10px); box-shadow: 0 1px 2px rgba(15,23,42,0.04);
}
html.dark .glass { background: rgba(255,255,255,0.045); border: 1px solid rgba(255,255,255,0.09); box-shadow: none; }

/* 表单输入框 */
.field {
  width: 100%; border-radius: .75rem; border: 1px solid rgba(15,23,42,0.12);
  background: #fff; padding: .625rem 1rem; color: #0f172a;
  outline: none; transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.field::placeholder { color: #94a3b8; }
.field:focus { border-color: rgba(6,182,212,0.7); box-shadow: 0 0 0 3px rgba(6,182,212,0.15); }
.field:disabled { opacity: .6; cursor: not-allowed; }
html.dark .field {
  border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.06); color: #e7edf3;
}
html.dark .field::placeholder { color: #64748b; }
html.dark .field:focus { border-color: rgba(34,211,238,0.7); box-shadow: 0 0 0 3px rgba(34,211,238,0.18); }

/* 主按钮 */
.btn-primary {
  border-radius: .75rem; padding: .625rem 1.25rem; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, #06b6d4, #7c3aed);
  transition: filter .15s, transform .1s;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:active { transform: scale(.98); }

/* 次要按钮 */
.btn-ghost {
  border-radius: .75rem; padding: .625rem 1.25rem; font-weight: 600; color: #334155;
  border: 1px solid rgba(15,23,42,0.12); background: rgba(255,255,255,0.7);
  transition: background .15s, border-color .15s;
}
.btn-ghost:hover { background: rgba(15,23,42,0.05); }
html.dark .btn-ghost { color: #cbd5e1; border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.05); }
html.dark .btn-ghost:hover { background: rgba(255,255,255,0.1); }

/* 滚动条跟随主题 */
html.dark { scrollbar-color: rgba(255,255,255,0.18) transparent; }
html.dark ::-webkit-scrollbar { width: 10px; height: 10px; }
html.dark ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 9999px; }

/* ============ 同词相遇（WordMeet）游戏页 ============ */
.wm-confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.wm-confetti i {
  position: absolute; top: -10px; width: 8px; height: 14px; opacity: .9;
  animation: wm-fall linear infinite;
}
@keyframes wm-fall {
  0%   { transform: translateY(-10vh) rotate(0deg); }
  100% { transform: translateY(110vh) rotate(540deg); }
}
.wm-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9999px; font-weight: 700; color: #fff;
  overflow: hidden; flex: none;
  background: rgba(148,163,184,0.25);
  box-shadow: 0 0 0 1px rgba(15,23,42,0.06);
}
.wm-avatar img { width: 100%; height: 100%; display: block; object-fit: cover; }
html.dark .wm-avatar { box-shadow: 0 0 0 1px rgba(255,255,255,0.10); }
.wm-cell { font-variant-numeric: tabular-nums; }

/* 通用 DiceBear 头像容器（圆角方：房间成员列表 / 游戏玩家列表用）。
   与 .wm-avatar 的区别仅是圆角（rounded-xl），其余（overflow、img 填充、onerror 回退）一致。 */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: .75rem; font-weight: 700; color: #fff;
  overflow: hidden; flex: none;
  background: rgba(148,163,184,0.25);
  box-shadow: 0 0 0 1px rgba(15,23,42,0.06);
}
.avatar img { width: 100%; height: 100%; display: block; object-fit: cover; }
html.dark .avatar { box-shadow: 0 0 0 1px rgba(255,255,255,0.10); }

/* ---- 玩家卡片：状态点（橙色思考中 / 绿色已提交，闪动） ---- */
.wm-dot {
  width: .5rem; height: .5rem; border-radius: 9999px; flex: none;
  background: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,0.18);
  animation: wm-dot-blink 3s ease-in-out infinite;
}
.wm-dot--done {
  background: #10b981; box-shadow: 0 0 0 3px rgba(16,185,129,0.18);
  animation: none;
}
@keyframes wm-dot-blink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .5; transform: scale(.88); }
}

/* 状态点由橙转绿时的一次轻动画（提交完成的即时反馈） */
.wm-dot--pop { animation: wm-dot-pop 1.2s cubic-bezier(.34,1.56,.64,1) 1; }
@keyframes wm-dot-pop {
  0%   { transform: scale(.7); box-shadow: 0 0 0 0 rgba(16,185,129,.45); }
  45%  { transform: scale(1.2); box-shadow: 0 0 0 7px rgba(16,185,129,0); }
  100% { transform: scale(1); box-shadow: 0 0 0 3px rgba(16,185,129,0.18); }
}

/* 玩家卡片刚完成时的整体泛绿提示。
   做法：卡片本身不动，绿色由一层「叠加高亮」来呈现。
   - 叠加层用纯 opacity 动画（只走合成层，不触发重排/重绘布局），轮询重建也顺滑；
   - 缓动：前 ~12% 快速亮起，随后长尾柔和淡出，避免旧的 ease-out 前段「僵住」的卡顿感。 */
.wm-player { position: relative; isolation: isolate; }
.wm-player--done-flash::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  pointer-events: none; z-index: -1;
  background: rgba(16,185,129,.16);
  box-shadow: inset 0 0 0 1px rgba(16,185,129,.55);
  animation: wm-player-flash 2.4s cubic-bezier(.16,.84,.32,1) 1 forwards;
  will-change: opacity;
}
html.dark .wm-player--done-flash::after {
  background: rgba(16,185,129,.20);
  box-shadow: inset 0 0 0 1px rgba(16,185,129,.60);
}
@keyframes wm-player-flash {
  0%   { opacity: 0; }
  12%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ---- 新一轮过渡 ---- */
.wm-round-enter { animation: wm-round-enter .55s cubic-bezier(.22,1,.36,1) 1; }
@keyframes wm-round-enter {
  0%   { opacity: 0; transform: translateY(10px) scale(.985); }
  100% { opacity: 1; transform: none; }
}

/* 条目交错入场：每张卡片轻微上浮淡入（animation-delay 由 JS 按序注入） */
.wm-item-up { animation: wm-item-up .45s cubic-bezier(.22,1,.36,1) both; }
@keyframes wm-item-up {
  0%   { opacity: 0; transform: translateY(8px) scale(.98); }
  100% { opacity: 1; transform: none; }
}

/* 轮数数字切换时的一次弹性放大 */
.wm-roundno-bump { animation: wm-roundno-bump .6s cubic-bezier(.34,1.56,.64,1) 1; }
@keyframes wm-roundno-bump {
  0%   { transform: scale(.72); opacity: .4; filter: blur(2px); }
  60%  { transform: scale(1.08); opacity: 1; filter: blur(0); }
  100% { transform: scale(1); }
}

/* 整页在新一轮开始时的一次柔和亮度过场 */
.wm-page-fade { animation: wm-page-fade .5s ease-out 1; }
@keyframes wm-page-fade {
  0%   { opacity: .35; }
  100% { opacity: 1; }
}

/* ---- 「只有我还没提交」的红色边缘轻提示 ----
   目标：给出紧迫感，但绝不能明显/挡视野 —— 「以边缘为主」，不要整屏泛红。
   做法：单层暗角（vignette）渐变，中心 55% 内完全为 0 不透明度，
   红色只在贴近四条边的 74%~100% 区间缓慢增强，最大也只有 .30；
   配合四边内阴影收束，观感就是屏幕边框在轻轻发红，页面主体颜色不变；
   - pointer-events: none 保证不拦截任何点击；
   - z-index 低于总结覆盖层（z-50），不会盖住结算页；
   - 只做很轻的 opacity 呼吸（合成层动画），避开大幅明暗跳变；
   - 默认 opacity 0 + visibility:hidden，未激活时完全不参与渲染。 */
.wm-last-one-glow {
  position: fixed; inset: 0; z-index: 40;
  pointer-events: none;
  opacity: 0; visibility: hidden;
  transition: opacity .45s ease, visibility 0s linear .45s;
  /* 只有一圈「暗角」：中心 55% 完全透明，颜色全部压在外框，且最内侧的渐变也归零，
     所以视线中心（输入框、按钮、记录区）一点红色都看不到，只有屏幕边缘泛红。 */
  background:
    radial-gradient(ellipse 86% 74% at 50% 50%,
      rgba(244,63,94,0) 55%,
      rgba(244,63,94,.05) 74%,
      rgba(244,63,94,.16) 90%,
      rgba(244,63,94,.30) 100%);
  /* 极细的内描边 + 贴近四边的内阴影，让「边缘感」更明确，不向中心扩散 */
  box-shadow:
    inset 0 0 0 1px rgba(244,63,94,.22),
    inset 0 22px 44px -32px rgba(244,63,94,.32),
    inset 0 -22px 44px -32px rgba(244,63,94,.32),
    inset 22px 0 44px -32px rgba(244,63,94,.26),
    inset -22px 0 44px -32px rgba(244,63,94,.26);
}
.wm-last-one-glow.is-on {
  opacity: 1; visibility: visible;
  transition: opacity .45s ease, visibility 0s;
  animation: wm-last-one-breathe 3.2s ease-in-out .45s infinite;
}
html.dark .wm-last-one-glow {
  /* 深色背景上红光会显得更艳，刻意把亮度/不透明度再压低一档 */
  background:
    radial-gradient(ellipse 86% 74% at 50% 50%,
      rgba(251,113,133,0) 55%,
      rgba(251,113,133,.05) 74%,
      rgba(251,113,133,.13) 90%,
      rgba(251,113,133,.24) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(251,113,133,.20),
    inset 0 22px 44px -32px rgba(251,113,133,.26),
    inset 0 -22px 44px -32px rgba(251,113,133,.26),
    inset 22px 0 44px -32px rgba(251,113,133,.22),
    inset -22px 0 44px -32px rgba(251,113,133,.22);
}
/* 呼吸幅度刻意很小（.75 → 1），只是「边缘轻轻亮了又暗」，不刺眼 */
@keyframes wm-last-one-breathe {
  0%, 100% { opacity: .75; }
  50%      { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .wm-dot, .wm-dot--pop, .wm-player--done-flash::after,
  .wm-round-enter, .wm-roundno-bump, .wm-page-fade,
  .wm-last-one-glow { animation: none !important; }
}

/* ============ 首页：正在游戏的房间高亮 ============ */
.room-card { transition: box-shadow .2s, border-color .2s, transform .2s; }

/* 我参与且正在游戏的房间：常态即带琥珀色描边强调 */
.room-card--playing {
  border-color: rgba(245,158,11,0.55) !important;
  background: rgba(245,158,11,0.07);
  box-shadow: 0 0 0 1px rgba(245,158,11,0.35), 0 8px 24px -12px rgba(245,158,11,0.5);
}
html.dark .room-card--playing {
  background: rgba(245,158,11,0.10);
  box-shadow: 0 0 0 1px rgba(245,158,11,0.45), 0 8px 24px -12px rgba(245,158,11,0.6);
}

/* 打开页面时的一次性脉冲高亮，帮助视线聚焦 */
.room-card--flash {
  animation: room-pulse 1.4s ease-out 1;
}
@keyframes room-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(245,158,11,0.55), 0 8px 24px -12px rgba(245,158,11,0.5); }
  60%  { box-shadow: 0 0 0 8px rgba(245,158,11,0.0),  0 8px 24px -12px rgba(245,158,11,0.5); }
  100% { box-shadow: 0 0 0 0 rgba(245,158,11,0.0),   0 8px 24px -12px rgba(245,158,11,0.5); }
}

/* ============ 房间页：最近对局行（可点击查看每轮词） ============ */
/* 每行左侧为「序号 + 时间」，整行可点击；hover / 聚焦给出可交互反馈 */
.session-row {
  display: flex; flex-wrap: wrap; align-items: center;
  column-gap: .75rem; row-gap: .25rem;
  border-radius: .75rem; padding: .75rem 1rem;
  border: 1px solid rgba(15,23,42,0.08);
  background: rgba(148,163,184,0.12);
  cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.session-row:hover { border-color: rgba(6,182,212,0.45); background: rgba(6,182,212,0.06); }
.session-row:focus-visible { outline: none; border-color: rgba(6,182,212,0.6); box-shadow: 0 0 0 3px rgba(6,182,212,0.15); }
html.dark .session-row { border: 1px solid rgba(255,255,255,0.07); background: rgba(255,255,255,0.05); }
html.dark .session-row:hover { border-color: rgba(34,211,238,0.5); background: rgba(34,211,238,0.08); }

/* ============ 通用确认弹窗（app.js confirmDialog） ============ */
/* 结构用 Tailwind 类（与站点弹层一致）；这里只补一点入场过渡，让弹出更柔和。 */
.play-modal { animation: play-modal-fade .18s ease-out; }
.play-modal-panel { animation: play-modal-pop .22s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes play-modal-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes play-modal-pop {
  from { opacity: 0; transform: translateY(8px) scale(.96); }
  to   { opacity: 1; transform: none; }
}

/* 顶部轻提示 toast */
.room-toast {
  position: fixed; left: 50%; top: 4.5rem; z-index: 50;
  display: flex; align-items: center; gap: .6rem;
  padding: .7rem 1rem; border-radius: .9rem;
  background: #fffbeb; color: #92400e;
  border: 1px solid rgba(245,158,11,0.5);
  box-shadow: 0 10px 30px -10px rgba(245,158,11,0.55);
  font-size: .85rem; font-weight: 600;
  transform: translate(-50%, -12px); opacity: 0;
  transition: transform .3s ease, opacity .3s ease;
  pointer-events: none; max-width: calc(100vw - 2rem);
}
html.dark .room-toast { background: #271a02; color: #fcd34d; }
.room-toast--in { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }

/* 复制成功（绿）/ 复制失败（红）轻提示 */
.room-toast--ok {
  background: #ecfdf5; color: #065f46;
  border-color: rgba(16,185,129,0.5);
  box-shadow: 0 10px 30px -10px rgba(16,185,129,0.55);
}
html.dark .room-toast--ok { background: #04271a; color: #6ee7b7; }
.room-toast--err {
  background: #fef2f2; color: #991b1b;
  border-color: rgba(239,68,68,0.5);
  box-shadow: 0 10px 30px -10px rgba(239,68,68,0.5);
}
html.dark .room-toast--err { background: #2a0a0a; color: #fca5a5; }
.room-toast__dot {
  width: .5rem; height: .5rem; border-radius: 9999px; background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245,158,11,0.25); flex: none;
}
.room-toast__go { color: inherit; text-decoration: underline; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) {
  .room-card--flash { animation: none; }
  .room-toast { transition: opacity .2s ease; transform: translate(-50%, 0); }
  .play-modal, .play-modal-panel { animation: none; }
}

/* ============ 首页「加入房间」的房间码占位示例 ============ */
/* 占位码由 home.js 每 10 秒随机换一个（字符集与后端 random_base32 一致）。
   原生 placeholder 做不出动画，所以这里用一层叠加在输入框上的「幽灵文字」
   .code-hint 来显示；原生 placeholder 设为不可见的 &nbsp;，只用于
   :placeholder-shown 判断用户是否已输入。 */
.code-field { position: relative; }
.code-hint {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none; user-select: none;
  font-size: 1.5rem; line-height: 2rem;      /* 与输入框的 text-2xl 对齐 */
  letter-spacing: .5em; text-transform: uppercase;
  color: #94a3b8;
  transition: opacity .18s ease;
}
html.dark .code-hint { color: #64748b; }
/* 已输入内容 / 聚焦时隐藏，与原生 placeholder 行为保持一致 */
.code-field input:not(:placeholder-shown) + .code-hint,
.code-field input:focus + .code-hint { opacity: 0; }
/* 换码时的轻动画：淡入 + 轻轻上浮 + 由模糊转清晰 */
.code-hint--in { animation: code-hint-swap .55s cubic-bezier(.22, 1, .36, 1); }
@keyframes code-hint-swap {
  0%   { opacity: 0; transform: translateY(5px); filter: blur(3px); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: none; filter: blur(0); }
}

/* ============ 首页「附近匹配」雷达扫描（纯前端演示，不请求服务器） ============ */
/* 比主按钮小一号的次要按钮：与 .btn-ghost 组合使用 */
.btn-ghost.btn-compact { padding: .5rem 1rem; font-size: .875rem; }

.nearby-modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
  animation: play-modal-fade .18s ease-out;
}
.nearby-backdrop {
  position: absolute; inset: 0;
  background: rgba(15,23,42,0.5);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.nearby-panel {
  position: relative; text-align: center; overflow: hidden;
  width: min(23rem, calc(100vw - 2rem));
  border-radius: 1rem; padding: 1.75rem 1.5rem 1.5rem;
  background: #fff; border: 1px solid rgba(15,23,42,0.08);
  box-shadow: 0 24px 60px -24px rgba(15,23,42,0.45);
}
html.dark .nearby-panel {
  background: #0f172a; border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 24px 60px -24px rgba(0,0,0,0.7);
}

/* 雷达盘面：同心圆网格 + 中心淡辉光 */
.nearby-radar {
  position: relative; width: 13rem; height: 13rem; margin: .25rem auto;
  border-radius: 9999px; overflow: hidden;
  border: 1px solid rgba(6,182,212,0.35);
  background:
    radial-gradient(circle at 50% 50%, rgba(6,182,212,0.10), rgba(6,182,212,0.01) 72%),
    repeating-radial-gradient(circle closest-side at 50% 50%, rgba(6,182,212,0.28) 0 1px, transparent 1px 25%);
  box-shadow: inset 0 0 34px rgba(6,182,212,0.20), 0 0 40px -14px rgba(6,182,212,0.55);
  transition: box-shadow .45s ease;
}
html.dark .nearby-radar {
  border-color: rgba(34,211,238,0.32);
  background:
    radial-gradient(circle at 50% 50%, rgba(34,211,238,0.12), rgba(34,211,238,0.01) 72%),
    repeating-radial-gradient(circle closest-side at 50% 50%, rgba(34,211,238,0.26) 0 1px, transparent 1px 25%);
  box-shadow: inset 0 0 34px rgba(34,211,238,0.20), 0 0 46px -14px rgba(34,211,238,0.55);
}
/* 十字准线 */
.nearby-radar::before,
.nearby-radar::after { content: ''; position: absolute; background: rgba(6,182,212,0.18); }
html.dark .nearby-radar::before,
html.dark .nearby-radar::after { background: rgba(34,211,238,0.16); }
.nearby-radar::before { left: 50%; top: 0; bottom: 0; width: 1px; transform: translateX(-50%); }
.nearby-radar::after  { top: 50%; left: 0; right: 0; height: 1px; transform: translateY(-50%); }

/* 旋转的扫描光束 */
.nearby-sweep {
  position: absolute; inset: 0; border-radius: 9999px;
  background: conic-gradient(from 0deg,
    rgba(34,211,238,0.55), rgba(34,211,238,0.18) 18%,
    rgba(34,211,238,0) 40%, rgba(34,211,238,0) 100%);
  transition: opacity .45s ease;
  animation: nearby-sweep 2.4s linear infinite;
}
@keyframes nearby-sweep { to { transform: rotate(360deg); } }

/* 由中心向外扩散的波纹 */
.nearby-pulse {
  position: absolute; left: 50%; top: 50%; width: 100%; height: 100%;
  border-radius: 9999px; border: 1px solid rgba(34,211,238,0.5);
  transform: translate(-50%, -50%) scale(.1); opacity: 0;
  animation: nearby-pulse 2.8s cubic-bezier(.22, .61, .36, 1) infinite;
}
@keyframes nearby-pulse {
  0%   { transform: translate(-50%, -50%) scale(.1); opacity: .85; }
  70%  { opacity: .30; }
  100% { transform: translate(-50%, -50%) scale(.96); opacity: 0; }
}

/* 被扫到的「信号点」 */
.nearby-blip {
  position: absolute; width: .5rem; height: .5rem; margin: -.25rem;
  border-radius: 9999px; background: #22d3ee;
  box-shadow: 0 0 10px rgba(34,211,238,0.9);
  opacity: 0; transform: scale(.4);
  transition: opacity .3s ease;
  animation: nearby-blip 2.6s ease-out infinite;
}
@keyframes nearby-blip {
  0%   { opacity: 0;  transform: scale(.4); }
  18%  { opacity: 1;  transform: scale(1.15); }
  32%  { transform: scale(1); }
  70%  { opacity: .9; }
  100% { opacity: 0;  transform: scale(.7); }
}

/* 圆心的「我」 */
.nearby-core {
  position: absolute; left: 50%; top: 50%; z-index: 2;
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.75rem; height: 1.75rem; border-radius: 9999px; color: #fff;
  background: linear-gradient(135deg, #06b6d4, #7c3aed);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 4px rgba(6,182,212,0.18), 0 2px 8px rgba(15,23,42,0.35);
}

/* 扫描结束：收起光束与信号点，保留一圈更淡的静态雷达 */
.nearby-radar.is-done { box-shadow: inset 0 0 30px rgba(6,182,212,0.12), 0 0 30px -18px rgba(6,182,212,0.45); }
.nearby-radar.is-done .nearby-sweep { opacity: 0; }
.nearby-radar.is-done .nearby-blip { opacity: 0; animation: none; }

/* 文案与操作 */
.nearby-status { margin-top: 1.1rem; font-size: .95rem; font-weight: 600; color: #0f172a; }
html.dark .nearby-status { color: #e7edf3; }
.nearby-hint {
  margin-top: .35rem; min-height: 1.5rem;
  font-size: .8rem; line-height: 1.5rem; color: #64748b;
}
html.dark .nearby-hint { color: #94a3b8; }
.nearby-dots i { font-style: normal; opacity: .2; animation: nearby-dot 1.4s ease-in-out infinite; }
.nearby-dots i:nth-child(2) { animation-delay: .18s; }
.nearby-dots i:nth-child(3) { animation-delay: .36s; }
@keyframes nearby-dot { 0%, 100% { opacity: .2; } 30% { opacity: 1; } }

.nearby-actions { margin-top: 1.25rem; display: flex; justify-content: center; gap: .5rem; }
/* 本文件在 Tailwind 之后加载，这里再兜一次底，保证「重新搜索」初始隐藏 */
.nearby-modal .hidden { display: none; }

@media (prefers-reduced-motion: reduce) {
  .nearby-sweep, .nearby-pulse, .nearby-blip,
  .nearby-dots i, .code-hint--in { animation: none !important; }
  .nearby-blip { opacity: 0; }
  .nearby-dots i { opacity: 1; }
}

/* ============ 默契画一画（DrawTogether）游戏页 ============ */
/* 画布默认正方形：容器用 aspect-ratio 保证 高=宽，
   绘制页与揭晓页共用同一套「归一化坐标 × k」映射（见 dt-panel.js）。
   聚焦 / 沉浸时由 JS 按「当前视角」的宽高比直接写死内联宽高，覆盖这里的正方形。 */
.dt-board {
  position: relative; width: 100%; aspect-ratio: 1 / 1;
  /* 触屏：禁止长按选择 / 长按呼出菜单 / 双击缩放，避免作画时误触 */
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;   /* 连画板容器一并禁掉滚动 / 双击缩放 */
}
.dt-board canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: block; touch-action: none; cursor: crosshair;
  border-radius: .9rem; background: #fff;
  box-shadow: inset 0 0 0 1px rgba(15,23,42,0.08);
}
html.dark .dt-board canvas { background: rgba(255,255,255,0.04); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.10); }
.dt-board.is-locked canvas { cursor: default; }
/* 聚焦时整块画板就是「我这一块」：换成一圈淡淡的品牌色描边，和平时区分开。
   外圈再叠一层极淡的柔光，和「作画时自己区块」那圈边框的发光观感一致。 */
.dt-board.is-focus canvas { box-shadow: inset 0 0 0 1.5px rgba(6,182,212,0.32), 0 0 14px rgba(6,182,212,0.16); }
html.dark .dt-board.is-focus canvas { box-shadow: inset 0 0 0 1.5px rgba(34,211,238,0.30), 0 0 16px rgba(34,211,238,0.16); }

/* ---- 对方区块：已改为在画布上直接画一个浅色大 X（见 dt-panel.js drawOpponentMarksOn）。
   不再需要磨砂遮罩 / 问号，故这里不再保留 .dt-frost / .dt-frost-cell 相关样式。
   顺带：对方区块「不铺点阵」——点阵只画在「我这一块」（同样是 canvas 绘制）。 ---- */

/* ---- 聚焦时的「接缝」提示 ----
   聚焦后画板只剩我这一块，边界容易让人以为「这就是整张画」。
   于是在「与邻座相接的那几条边」（位于整张画布内部的那几条）上留一道极简提示：
   一条虚线 + 一层向内淡出的品牌色渐变 + 中间的箭头小圆片（指向邻座）——
   意思很直白：画面从这里拼过去。画布外缘那几条边是画的尽头，不画接缝。 */
.dt-seam {
  position: absolute; inset: 0; z-index: 3;
  border-radius: .9rem; overflow: hidden; pointer-events: none;
}
.dt-seam-edge { position: absolute; display: flex; align-items: center; justify-content: center; }
.dt-seam-edge--l, .dt-seam-edge--r { top: 0; bottom: 0; width: 1.5rem; }
.dt-seam-edge--t, .dt-seam-edge--b { left: 0; right: 0; height: 1.5rem; }
.dt-seam-edge--l {
  left: 0; border-left: 2px dashed rgba(6,182,212,0.45);
  background: linear-gradient(to right, rgba(6,182,212,0.14), rgba(6,182,212,0));
}
.dt-seam-edge--r {
  right: 0; border-right: 2px dashed rgba(6,182,212,0.45);
  background: linear-gradient(to left, rgba(6,182,212,0.14), rgba(6,182,212,0));
}
.dt-seam-edge--t {
  top: 0; border-top: 2px dashed rgba(6,182,212,0.45);
  background: linear-gradient(to bottom, rgba(6,182,212,0.14), rgba(6,182,212,0));
}
.dt-seam-edge--b {
  bottom: 0; border-bottom: 2px dashed rgba(6,182,212,0.45);
  background: linear-gradient(to top, rgba(6,182,212,0.14), rgba(6,182,212,0));
}
.dt-seam-chip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.5rem; height: 1.5rem; border-radius: 9999px;
  color: #0891b2; background: rgba(255,255,255,0.92);
  box-shadow: 0 1px 5px rgba(15,23,42,0.18), 0 0 0 2px rgba(6,182,212,0.18);
  animation: dt-seam-breathe 2.6s ease-in-out infinite;
}
html.dark .dt-seam-chip {
  color: #22d3ee; background: rgba(15,23,42,0.78);
  box-shadow: 0 1px 5px rgba(0,0,0,0.5), 0 0 0 2px rgba(34,211,238,0.20);
}
@keyframes dt-seam-breathe { 0%, 100% { opacity: .72; } 50% { opacity: 1; } }

/* ---- 纯图标工具按钮（撤销 / 重做 / 清除 / 聚焦 / 退出沉浸） ---- */
.dt-iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.5rem; height: 2.5rem; border-radius: .75rem; flex: none;
  color: #334155; border: 1px solid rgba(15,23,42,0.12); background: rgba(255,255,255,0.7);
  transition: background .15s, border-color .15s, color .15s, transform .1s;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.dt-iconbtn:hover { background: rgba(15,23,42,0.05); }
.dt-iconbtn:active { transform: scale(.94); }
.dt-iconbtn:disabled { opacity: .35; pointer-events: none; }
html.dark .dt-iconbtn { color: #cbd5e1; border-color: rgba(255,255,255,0.12); background: rgba(255,255,255,0.05); }
html.dark .dt-iconbtn:hover { background: rgba(255,255,255,0.1); }
.dt-iconbtn--danger { color: #e11d48; border-color: rgba(244,63,94,0.28); background: rgba(244,63,94,0.08); }
.dt-iconbtn--danger:hover { background: rgba(244,63,94,0.16); }
html.dark .dt-iconbtn--danger { color: #fda4af; border-color: rgba(244,63,94,0.35); background: rgba(244,63,94,0.14); }
html.dark .dt-iconbtn--danger:hover { background: rgba(244,63,94,0.22); }
/* .hidden 与 .dt-iconbtn 都是单类选择器，而本文件在 Tailwind 之后加载（同权重后者胜），
   这一条保证「.hidden 也真的能藏住图标按钮」——沉浸顶栏的聚焦开关就靠它。 */
.dt-iconbtn.hidden { display: none; }
/* 开关类按钮（聚焦 / 沉浸）的「已开启」态：一点品牌色，和未开启区分开 */
.btn-ghost.is-active,
.dt-iconbtn.is-active {
  color: #0e7490; border-color: rgba(6,182,212,0.5); background: rgba(6,182,212,0.12);
}
html.dark .btn-ghost.is-active,
html.dark .dt-iconbtn.is-active {
  color: #67e8f9; border-color: rgba(34,211,238,0.45); background: rgba(34,211,238,0.14);
}

/* ---- 沉浸式画画 ----
   #dt-stage 平时 display:contents（不产生盒子，子元素按原布局排列）。
   注意：画布卡片用了 .glass（backdrop-filter），而 backdrop-filter 会让
   position:fixed 的后代以「该卡片」而非「视口」为包含块——那样沉浸层只会
   撑满卡片、画布反而更小。所以进入沉浸时由 JS 把 stage 挪到 <body> 下，
   再整体变成固定全屏层；画布尺寸由 JS 按视口算成正方形，尽量撑满。 */
.dt-stage { display: contents; }
.dt-stage-bar { display: none; }

html.dt-immersive, html.dt-immersive body { overflow: hidden; overscroll-behavior: contain; }

html.dt-immersive #dt-stage {
  position: fixed; inset: 0; z-index: 80;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .5rem;
  padding: max(.5rem, env(safe-area-inset-top)) max(.5rem, env(safe-area-inset-right))
           max(.5rem, env(safe-area-inset-bottom)) max(.5rem, env(safe-area-inset-left));
  background: #f6f7f9;
  overflow: hidden;
}
html.dark.dt-immersive #dt-stage { background: #0b1220; }
html.dt-immersive #dt-stage .dt-stage-bar {
  display: flex; align-items: center; gap: .6rem;
  width: 100%; flex: none;
}
html.dt-immersive #dt-stage .dt-board { flex: none; max-width: none !important; margin: 0; }
html.dt-immersive #dt-stage .dt-toolbar { flex: none; width: 100%; justify-content: center; margin-top: 0; }
html.dt-immersive #dt-stage .dt-toolbar #dt-colors { flex-wrap: wrap; }
html.dt-immersive #dt-stage #dt-hint { display: none; }

/* 沉浸顶栏的「本轮主题」：占满中间剩余空间，过长则用省略号裁切（不挤走右侧进度与按钮）。
   顶栏其余子项默认不参与收缩，只让主题这一项弹性伸缩。 */
html.dt-immersive #dt-stage .dt-stage-bar > * { flex: none; }
html.dt-immersive #dt-stage .dt-stage-bar #dt-stage-prompt {
  flex: 1 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* 调色板色块 */
.dt-swatch {
  width: 1.75rem; height: 1.75rem; border-radius: .5rem; flex: none;
  border: 2px solid transparent; transition: transform .12s, border-color .12s;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.dt-swatch:hover { transform: scale(1.08); }
.dt-swatch.is-active { border-color: #0f172a; }
html.dark .dt-swatch.is-active { border-color: #fff; }

/* 历史画廊：正方形缩略图容器 */
.dt-thumb { position: relative; width: 100%; aspect-ratio: 1 / 1; }
.dt-thumb canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; border-radius: .75rem; background: #fff; box-shadow: inset 0 0 0 1px rgba(15,23,42,0.08); }
html.dark .dt-thumb canvas { background: rgba(255,255,255,0.04); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.10); }

/* ---- 「已提交人数」闪一下（别人新提交时） ----
   #dt-progress / #dt-stage-progress 都是 flex 子项（被 blockify），transform 直接生效。
   颜色只在中间关键帧给出，首尾沿用元素自身颜色 → 平滑地亮起再落回，且不留残余高亮。 */
@keyframes dt-count-flash {
  0%   { transform: scale(1); }
  25%  { transform: scale(1.5);  color: #0891b2; }
  55%  { transform: scale(1.18); color: #0891b2; }
  100% { transform: scale(1); }
}
@keyframes dt-count-flash-dark {
  0%   { transform: scale(1); }
  25%  { transform: scale(1.5);  color: #67e8f9; }
  55%  { transform: scale(1.18); color: #67e8f9; }
  100% { transform: scale(1); }
}
.dt-count-flash { animation: dt-count-flash .7s cubic-bezier(.34,1.56,.64,1); }
html.dark .dt-count-flash { animation-name: dt-count-flash-dark; }

@media (prefers-reduced-motion: reduce) {
  .dt-seam-chip { animation: none; opacity: .9; }
}

/* ============ 房间聊天（chat.js） ============
   三套形态共用一个组件，仅靠容器上的 .chat--lobby / .chat--game / .chat--immersive 区分：
     lobby      等待区：内联卡片，面板常开，消息区固定高度内部滚动
     game       普通游戏页：右下角浮动气泡 → 抽屉，z-index 低于结算覆盖层(z-50)
     immersive  画一画沉浸全屏：入口融入沉浸顶栏，抽屉为右侧窄玻璃面板，z-index 高于沉浸层(z-80)
   全部用自定义类（不用 Tailwind 工具类），避免按需生成时首次渲染闪烁。 */
.chat { position: relative; }

.chat-panel { display: flex; flex-direction: column; overflow: hidden; }

.chat-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.chat-title { font-weight: 600; font-size: .9rem; color: #0f172a; }
html.dark .chat-title { color: #fff; }
.chat-close {
  margin-left: auto; display: inline-flex; align-items: center; justify-content: center;
  width: 1.75rem; height: 1.75rem; border-radius: .5rem; color: #64748b; flex: none;
}
.chat-close:hover { background: rgba(15,23,42,.06); }
html.dark .chat-close { color: #94a3b8; }
html.dark .chat-close:hover { background: rgba(255,255,255,.1); }

.chat-body { position: relative; overflow-y: auto; overscroll-behavior: contain; }
.chat-list { display: flex; flex-direction: column; gap: .5rem; padding-right: .15rem; }

.chat-item { display: flex; align-items: flex-end; gap: .5rem; }
.chat-avatar {
  width: 1.75rem; height: 1.75rem; flex: none; border-radius: .6rem; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; color: #fff;
  background: rgba(148,163,184,.28); box-shadow: 0 0 0 1px rgba(15,23,42,.06);
}
.chat-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
html.dark .chat-avatar { box-shadow: 0 0 0 1px rgba(255,255,255,.1); }
/* 无头像的行（自己发的 / 同一人连发）：保留占位以对齐气泡，只是看不见 */
.chat-item--bare .chat-avatar { visibility: hidden; }

.chat-main { min-width: 0; max-width: 82%; }
.chat-meta { display: flex; align-items: center; gap: .4rem; margin-bottom: .15rem; font-size: .7rem; color: #94a3b8; }
.chat-time { font-variant-numeric: tabular-nums; }
.chat-bubble {
  display: inline-block; padding: .4rem .65rem; border-radius: .8rem;
  background: rgba(148,163,184,.18); color: #0f172a;
  font-size: .85rem; line-height: 1.45;
  white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere;
}
html.dark .chat-bubble { background: rgba(255,255,255,.08); color: #e7edf3; }

/* 我的消息：右对齐 + 品牌色气泡 */
.chat-item--me { flex-direction: row-reverse; }
.chat-item--me .chat-main { text-align: right; }
.chat-item--me .chat-meta { justify-content: flex-end; }
.chat-item--me .chat-bubble {
  background: linear-gradient(135deg, #06b6d4, #7c3aed); color: #fff;
  text-align: left;
}

.chat-empty { list-style: none; padding: 1rem 0; text-align: center; font-size: .8rem; color: #94a3b8; }
.chat-empty[hidden] { display: none; }

/* 「有 N 条新消息」：贴在消息区底部，点了回到底部并清未读 */
.chat-jump {
  position: sticky; bottom: .25rem; display: block; margin: .25rem auto 0;
  padding: .3rem .8rem; border-radius: 9999px;
  font-size: .72rem; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, #06b6d4, #7c3aed);
  box-shadow: 0 8px 20px -10px rgba(6,182,212,.9);
}
.chat-jump[hidden] { display: none; }

.chat-form { display: flex; align-items: center; gap: .4rem; margin-top: .5rem; }
.chat-input {
  flex: 1 1 auto; min-width: 0; border-radius: 9999px;
  border: 1px solid rgba(15,23,42,.12); background: #fff; padding: .45rem .85rem;
  font-size: .85rem; color: #0f172a; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.chat-input::placeholder { color: #94a3b8; }
.chat-input:focus { border-color: rgba(6,182,212,.7); box-shadow: 0 0 0 3px rgba(6,182,212,.15); }
.chat-input:disabled { opacity: .6; cursor: not-allowed; }
html.dark .chat-input { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.12); color: #e7edf3; }
html.dark .chat-input::placeholder { color: #64748b; }
.chat-send {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem; border-radius: 9999px; color: #fff;
  background: linear-gradient(135deg, #06b6d4, #7c3aed);
  transition: filter .15s, transform .1s;
}
.chat-send:hover { filter: brightness(1.08); }
.chat-send:active { transform: scale(.94); }
.chat-send:disabled { opacity: .5; cursor: not-allowed; }
.chat-send i { font-size: 1.05rem; line-height: 1; }

/* 未读徽标：挂在各入口按钮（浮动气泡 / 沉浸顶栏聊天按钮）上 */
.chat-has-badge-host { position: relative; }
.chat-badge {
  position: absolute; top: -.25rem; right: -.25rem; min-width: 1.1rem; height: 1.1rem;
  padding: 0 .3rem; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9999px; background: #f43f5e; color: #fff;
  font-size: .65rem; font-weight: 700; line-height: 1;
  box-shadow: 0 0 0 2px rgba(255,255,255,.85);
}
.chat-badge[hidden] { display: none; }
html.dark .chat-badge { box-shadow: 0 0 0 2px rgba(15,23,42,.85); }

/* ---- 等待区（lobby）：内联卡片，面板常开 ---- */
.chat--lobby .chat-body { height: 20rem; }

/* ---- 浮动气泡入口（game / immersive） ---- */
.chat-fab {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 40;
  display: inline-flex; align-items: center; justify-content: center;
  width: 3rem; height: 3rem; border-radius: 9999px; color: #fff;
  background: linear-gradient(135deg, #06b6d4, #7c3aed);
  box-shadow: 0 12px 30px -12px rgba(6,182,212,.85);
  transition: transform .15s, filter .15s, opacity .18s;
}
.chat-fab:hover { filter: brightness(1.06); }
.chat-fab:active { transform: scale(.95); }
.chat-fab i { font-size: 1.35rem; line-height: 1; }
.chat-fab.is-on { opacity: 0; visibility: hidden; }

/* ---- 抽屉（game / immersive）：默认收起，不占布局 ---- */
.chat--game .chat-panel,
.chat--immersive .chat-panel {
  position: fixed; z-index: 40; right: 1rem; bottom: 1rem;
  width: min(20rem, calc(100vw - 2rem)); max-height: min(28rem, 72vh);
  padding: .75rem; border-radius: 1rem;
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(15,23,42,.08);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  box-shadow: 0 18px 44px -20px rgba(15,23,42,.5);
  transform-origin: bottom right;
  transform: translateY(8px) scale(.98);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .18s ease, transform .18s ease, visibility 0s linear .18s;
}
.chat--game .chat-panel.is-open,
.chat--immersive .chat-panel.is-open {
  opacity: 1; visibility: visible; pointer-events: auto; transform: none;
  transition: opacity .18s ease, transform .18s ease, visibility 0s;
}
html.dark .chat--game .chat-panel,
html.dark .chat--immersive .chat-panel { background: rgba(15,23,42,.92); border-color: rgba(255,255,255,.1); }
.chat--game .chat-body,
.chat--immersive .chat-body { height: min(18rem, 52vh); }

/* ---- 画一画沉浸全屏：入口融入顶栏，抽屉为右侧窄玻璃面板 ----
   沉浸时 #dt-stage 是 z-80 的全屏层，故聊天抽屉抬到 z-90（低于确认弹窗 z-100）。
   浮动气泡在沉浸时隐藏，改用顶栏里的 #dt-stage-chat 按钮（见 draw.php）。 */
.chat--immersive .chat-panel {
  z-index: 90;
  top: .5rem; right: .5rem; bottom: .5rem;
  width: min(19rem, calc(100vw - 1rem)); max-height: none;
  background: rgba(255,255,255,.86);
}
html.dark .chat--immersive .chat-panel { background: rgba(15,23,42,.78); }
.chat--immersive .chat-body { height: auto; flex: 1 1 auto; }
.chat--immersive .chat-bubble { font-size: .8rem; }
.chat--immersive .chat-fab { z-index: 90; }
html.dt-immersive .chat--immersive .chat-fab { display: none; }

/* 沉浸顶栏里的聊天按钮：沿用 .dt-iconbtn 的亮/暗配色，未读小红点由 .chat-badge 提供。
   别在这里写死浅灰（旧值 #cbd5e1）：亮色沉浸层底色是近白的 #f6f7f9，浅灰图标会被看成「禁用」，
   而同一排的聚焦 / 退出按钮是 #334155，一对比更像坏了（其实点击一直正常）；
   暗色下 html.dark .dt-iconbtn 本就是 #cbd5e1，这里也无需再覆盖。 */

/* 窄屏（手机）：抽屉改为贴底 bottom-sheet，更省纵向空间 */
@media (max-width: 640px) {
  .chat--game .chat-panel,
  .chat--immersive .chat-panel {
    top: auto; left: .5rem; right: .5rem; bottom: .5rem;
    width: auto; max-height: 62vh;
    transform: translateY(10px);
  }
  .chat--immersive .chat-panel { max-height: 68vh; }
}

@media (prefers-reduced-motion: reduce) {
  .chat--game .chat-panel,
  .chat--immersive .chat-panel,
  .chat-fab { transition: none; }
}

/* ============ 默契画一画：setup 阶段（房主设布局 / 玩家入座） ============ */
.dt-stepper { display: inline-flex; align-items: center; gap: .45rem; }
.dt-stepper-label { font-size: .8rem; color: #64748b; }
html.dark .dt-stepper-label { color: #94a3b8; }
.dt-stepper-value {
  min-width: 1.75rem; text-align: center; font-weight: 800; font-size: 1rem;
  color: #0f172a; font-variant-numeric: tabular-nums;
}
html.dark .dt-stepper-value { color: #fff; }
/* setup 面板显示时，画板光标改成「点选」（点格子入座） */
.dt-board.is-seating canvas { cursor: pointer; }
/* .hidden 与本文件新类同权重时，确保真的能藏住 */
.dt-setup.hidden { display: none; }

/* ============ UNO：牌面 / 牌桌 / 席位 ============
   牌面只有三个数据来源（服务端 cards 表的 color / kind / value），画成什么样全在前端：
   一张牌 = 有色底 + 白心（.uno-card__inner），万能牌把底色换成四色扇形。
   宽度用 clamp：窄屏自动缩到约 3.2rem，一屏仍能放下 7 张手牌。 */
.uno-card {
  --uno-w: clamp(3.2rem, 11vw, 4.5rem);
  position: relative; flex: none;
  width: var(--uno-w); height: calc(var(--uno-w) * 1.46);
  padding: calc(var(--uno-w) * 0.078);
  border-radius: calc(var(--uno-w) * 0.18);
  background: #94a3b8;
  box-shadow:
    0 1px 1px rgba(15,23,42,0.14),
    0 6px 14px -8px rgba(15,23,42,0.30),
    0 0 0 1px rgba(15,23,42,0.08) inset,
    0 1px 0 rgba(255,255,255,0.40) inset;
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}
html.dark .uno-card {
  box-shadow:
    0 1px 2px rgba(0,0,0,0.50),
    0 8px 18px -10px rgba(0,0,0,0.70),
    0 0 0 1px rgba(255,255,255,0.10) inset,
    0 1px 0 rgba(255,255,255,0.16) inset;
}
/* 顶部柔光：纯色底不再死平，多了一层「上亮下暗」的立体感（.uno-card__inner 压在其上） */
.uno-card::before {
  content: ''; position: absolute; inset: 0; z-index: 0;
  border-radius: inherit; pointer-events: none;
  background: linear-gradient(160deg, rgba(255,255,255,0.28), rgba(255,255,255,0) 46%);
}
.uno-card__inner {
  position: relative; z-index: 1;
  display: flex; width: 100%; height: 100%; align-items: center; justify-content: center;
  border-radius: calc(var(--uno-w) * 0.12);
  background: linear-gradient(180deg, #ffffff, #f4f6fb);
  font-weight: 900; line-height: 1;
  letter-spacing: -0.02em;
  box-shadow: 0 2px 5px -1px rgba(15,23,42,0.14), 0 0 0 1px rgba(15,23,42,0.05);
  font-size: calc(var(--uno-w) * 0.45);
  font-variant-numeric: tabular-nums;
}
.uno-card--red    { background: linear-gradient(155deg, #fb7185, #e11d48 52%, #be123c); }
.uno-card--yellow { background: linear-gradient(155deg, #fcd34d, #f59e0b 52%, #d97706); }
.uno-card--green  { background: linear-gradient(155deg, #4ade80, #16a34a 52%, #15803d); }
.uno-card--blue   { background: linear-gradient(155deg, #60a5fa, #2563eb 52%, #1d4ed8); }
.uno-card--red    .uno-card__inner { color: #e11d48; }
.uno-card--yellow .uno-card__inner { color: #c2740a; }
.uno-card--green  .uno-card__inner { color: #15803d; }
.uno-card--blue   .uno-card__inner { color: #2563eb; }
/* 万能牌：四色扇形底，圆心用深色字（W / +4 / 调色盘图标）才看得清 */
.uno-card--wild { background: conic-gradient(#e11d48 0 25%, #f59e0b 0 50%, #16a34a 0 75%, #2563eb 0 100%); }
.uno-card--wild .uno-card__inner { color: #0f172a; background: linear-gradient(180deg, #ffffff, #f1f4f9); }

/* 弃牌堆顶：放大一档，坐落在牌桌中央（尺寸用 --uno-pile，沉浸时整体放大，见文末） */
.uno-card--lg { --uno-w: var(--uno-pile, clamp(4.5rem, 16vw, 6.5rem)); }

/* 可出 = 绿圈 + 悬浮抬起；不可出 = 压暗且不接收指针（服务端已判过合法性，这里只是别让人白点） */
.uno-card.is-playable { outline: 3px solid rgba(16,185,129,0.85); outline-offset: 2px; cursor: pointer; }
.uno-card.is-playable:hover { transform: translateY(-0.4rem); box-shadow: 0 12px 22px -8px rgba(15,23,42,0.35), 0 0 0 1px rgba(255,255,255,0.40) inset; }
.uno-card.is-playable:focus-visible { outline-color: #059669; }
.uno-card.is-dim { opacity: .62; }
.uno-card[aria-disabled="true"] { pointer-events: none; }

/* 弃牌堆顶容器：空的时候用虚线占位，避免首帧渲染时整块牌桌跳动 */
.uno-slot { display: flex; align-items: center; justify-content: center; position: relative; z-index: 1; min-width: var(--uno-pile, 4.5rem); min-height: calc(var(--uno-pile, 4.5rem) * 1.46); }
.uno-slot:empty::after {
  content: ''; display: block;
  width: var(--uno-pile, 4.5rem); height: calc(var(--uno-pile, 4.5rem) * 1.46);
  border-radius: .75rem; border: 2px dashed rgba(148,163,184,0.5);
}

/* ---- 牌桌：两个拟真牌堆（左 = 弃牌堆，右 = 摸牌堆） ---- */
.uno-pile { display: flex; flex-direction: column; align-items: center; gap: .5rem; }

/* 两张牌堆上方统一留一段净空：弃牌堆的垫牌边（.uno-pile__ghost）与摸牌堆的牌背（.uno-back）
   都会向上错开一点（见各自的 transform），留白不足就会顶到上面的内容、显得局促。
   净空随 --uno-pile 一起缩放，普通视图 / 沉浸都成比例。 */
.uno-pile, .uno-draw { margin-top: calc(var(--uno-pile, 4.5rem) * 0.18); }

/* 弃牌堆：容器尺寸与放大牌面一致；顶牌下垫若干「幽灵牌」（只露牌边），做出堆叠感 */
.uno-pile__stack {
  position: relative; display: grid; place-items: center;
  width: var(--uno-pile, 4.5rem);
  height: calc(var(--uno-pile, 4.5rem) * 1.46);
}
/* 垫牌容器：铺满牌堆、不接收指针；里面按「已打出的真实张数」放若干 .uno-pile__ghost（见 uno-panel.js） */
.uno-pile__ghosts { position: absolute; inset: 0; pointer-events: none; }
.uno-pile__ghost {
  position: absolute; inset: 0; margin: auto;
  width: 100%; height: 100%;
  border-radius: calc(var(--uno-pile, 4.5rem) * 0.17);
  background: linear-gradient(180deg, #e2e8f0, #cbd5e1); box-shadow: 0 1px 2px rgba(15,23,42,0.12), 0 0 0 1px rgba(15,23,42,0.04) inset;
  /* --i = 距顶牌第几层（0 = 紧贴顶牌，越大越靠底），由 uno-panel.js 按真实张数写入：
     越靠底的牌边越往左上外扩、越偏转，一摞牌就越显厚；横向多错开、纵向少抬，给堆顶留出净空。位移随 --uno-pile 一起缩放，
     普通视图 / 沉浸（牌堆更大）都成比例。 */
  transform: translate(calc(var(--i, 0) * var(--uno-pile, 4.5rem) * -0.034),
                       calc(var(--i, 0) * var(--uno-pile, 4.5rem) * -0.013))
             rotate(calc(var(--i, 0) * -1.5deg));
}
html.dark .uno-pile__ghost { background: #475569; box-shadow: none; }
/* 弃牌堆空着（还没开局）时不显示垫底牌；不支持 :has 的浏览器也因容器为空而无碍 */
.uno-pile__stack:has(#uno-top:empty) .uno-pile__ghosts { visibility: hidden; }

.uno-pile__meta { display: flex; align-items: center; gap: .4rem; }
.uno-pile__title { font-size: .72rem; color: #94a3b8; }
html.dark .uno-pile__title { color: #64748b; }

/* 当前颜色的胶囊：从顶栏挪到弃牌堆旁（万能牌之后颜色可能≠顶牌色，故单独标明） */
.uno-color-chip {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .15rem .5rem; border-radius: 9999px;
  background: rgba(15,23,42,0.05); color: #334155; font-size: .72rem;
}
html.dark .uno-color-chip { background: rgba(255,255,255,0.08); color: #cbd5e1; }

/* 摸牌堆：一摞背面朝上的牌，点它 = 摸牌；禁用时明确置灰（具体原因在 title / 提示文案里） */
.uno-draw {
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
  padding: 0; border: none; background: none; cursor: pointer;
  color: #334155;
}
html.dark .uno-draw { color: #cbd5e1; }
.uno-draw:disabled { cursor: not-allowed; }

.uno-deck {
  position: relative;
  width: var(--uno-pile, 4.5rem);
  height: calc(var(--uno-pile, 4.5rem) * 1.46);
  transition: transform .15s ease;
}
.uno-draw:not(:disabled):hover .uno-deck { transform: translateY(-3px); }
.uno-draw:disabled .uno-deck { opacity: .5; filter: grayscale(.4); }

/* 单张背面：红底 + 白色斜置椭圆（经典 UNO 牌背观感）。
   --i = 距正面第几层（0 = 正面那张），由 uno-panel.js 按「牌堆真实剩余张数」写入：
   越深的牌越往右上错开一点，整摞就显出与剩余张数相称的厚度；横向多错开、纵向少抬，给堆顶留出净空。偏移随 --uno-pile 一起缩放。 */
.uno-back {
  position: absolute; inset: 0; margin: auto;
  width: 100%; height: 100%;
  border-radius: calc(var(--uno-pile, 4.5rem) * 0.17);
  padding: calc(var(--uno-pile, 4.5rem) * 0.09);
  background: linear-gradient(150deg, #f87171 0%, #dc2626 46%, #991b1b 100%);
  box-shadow:
    0 2px 5px rgba(15,23,42,0.26),
    0 8px 16px -10px rgba(15,23,42,0.40),
    0 0 0 1px rgba(255,255,255,0.25) inset,
    0 1px 0 rgba(255,255,255,0.35) inset;
  transform: translate(calc(var(--i, 0) * var(--uno-pile, 4.5rem) * 0.024),
                       calc(var(--i, 0) * var(--uno-pile, 4.5rem) * -0.012));
}
html.dark .uno-back {
  box-shadow:
    0 2px 6px rgba(0,0,0,0.50),
    0 10px 20px -12px rgba(0,0,0,0.70),
    0 0 0 1px rgba(255,255,255,0.14) inset,
    0 1px 0 rgba(255,255,255,0.18) inset;
}
.uno-back--1 { display: flex; }
/* 摸牌堆摸空（正常会被洗回，极少见）：只留一张半透明的空壳，别再假装还有牌 */
.uno-deck.is-empty .uno-back { opacity: .3; }
.uno-deck.is-empty .uno-back--1 { background: none; box-shadow: 0 0 0 2px rgba(148,163,184,0.5) inset; }
.uno-deck.is-empty .uno-back__oval { opacity: .4; }
.uno-back__oval {
  display: flex; width: 100%; height: 100%; align-items: center; justify-content: center;
  border-radius: 50%; background: linear-gradient(180deg, #ffffff, #eef2f7);
  color: #dc2626; font-style: italic; font-weight: 900; letter-spacing: -.03em;
  font-size: calc(var(--uno-pile, 4.5rem) * 0.28);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.22), 0 1px 3px rgba(0,0,0,0.12) inset;
  transform: rotate(-22deg);
}
.uno-draw__label { font-size: .8rem; font-weight: 700; }

/* 喊 UNO：全桌唯一「现在必须点」的按钮，玫红实心 + 轻微呼吸（reduced-motion 下停掉） */
.uno-uno {
  padding: .6rem 1.1rem; border: none; border-radius: 9999px; cursor: pointer;
  background: linear-gradient(135deg, #e11d48, #f59e0b); color: #fff;
  font-size: .9rem; font-weight: 800; letter-spacing: .04em;
  box-shadow: 0 4px 12px rgba(225,29,72,0.35);
  animation: uno-uno-pulse 1.8s ease-in-out infinite;
}
.uno-uno:hover { filter: brightness(1.06); }
@keyframes uno-uno-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.05); }
}

/* 手牌区：换行排布，牌多 / 人多都不会溢出 */
.uno-hand { display: flex; flex-wrap: wrap; gap: .5rem; }

/* 万能牌选色：底色由 PHP 写在 style="--uno-c:#..."，这里只负责形状 */
.uno-colorbtn {
  padding: .45rem .95rem; border: none; border-radius: .7rem; cursor: pointer;
  background: var(--uno-c, #64748b); color: #fff;
  font-size: .85rem; font-weight: 700;
  box-shadow: 0 1px 2px rgba(15,23,42,0.18);
}
.uno-colorbtn:hover { filter: brightness(1.08); }

/* 状态条里的小胶囊（方向 / 当前颜色 / 牌堆-弃牌计数） */
.uno-chip {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .25rem .55rem; border-radius: 9999px;
  background: rgba(15,23,42,0.05); color: #334155; font-size: .75rem;
}
html.dark .uno-chip { background: rgba(255,255,255,0.08); color: #cbd5e1; }

/* 回合倒计时（本回合还剩几秒：turn_timeout - turn_age，由 uno-panel.js 起 tick）。
   与 .uno-chip 同形但数字用等宽数字（tabular-nums），免得每秒跳动时宽度抖动；
   .hidden 必须能压住 .uno-chip 的 display:inline-flex（同权重，靠登记顺序取胜）。 */
.uno-countdown { font-variant-numeric: tabular-nums; }
.uno-countdown.hidden { display: none; }
.uno-countdown__unit { color: #94a3b8; }
/* 剩 10s 内：转红 + 轻微呼吸，提示「再不出手就要被自动过手」 */
.uno-countdown.is-low { background: rgba(225,29,72,0.14); color: #be123c; animation: uno-countdown-pulse 1s ease-in-out infinite; }
html.dark .uno-countdown.is-low { background: rgba(244,63,94,0.18); color: #fda4af; }
@keyframes uno-countdown-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .uno-countdown.is-low { animation: none; } }

/* 当前颜色指示点：具体颜色由 JS 写 inline background（万能牌之后的颜色可能≠顶牌色），这里只管形状 */
.uno-dot {
  width: .75rem; height: .75rem; flex: none; border-radius: 9999px;
  background: #94a3b8; box-shadow: 0 0 0 1px rgba(15,23,42,0.15);
}
html.dark .uno-dot { box-shadow: 0 0 0 1px rgba(255,255,255,0.20); }

/* 席位行：轮到的人左侧亮青色条 + 淡底，一眼看出「现在是谁」 */
.uno-seat {
  display: flex; align-items: center; gap: .6rem;
  padding: .5rem .6rem; border-radius: .75rem;
  border: 1px solid rgba(15,23,42,0.08); border-left: 3px solid transparent;
  background: rgba(255,255,255,0.6);
}
html.dark .uno-seat { border-color: rgba(255,255,255,0.09); background: rgba(255,255,255,0.04); }
.uno-seat.is-turn { border-left-color: #06b6d4; background: rgba(6,182,212,0.08); }
html.dark .uno-seat.is-turn { background: rgba(34,211,238,0.10); }
/* 观战者（没入座）：整行压暗，不与真正的玩家抢注意力 */
.uno-seat.is-out { opacity: .6; }

/* 席位上的小标签：房主 / 我 / 已喊 UNO / 已离开 */
.uno-tag {
  display: inline-block; margin-left: .3rem; padding: 0 .3rem; border-radius: .35rem;
  font-size: .65rem; font-weight: 700; vertical-align: middle;
  background: rgba(15,23,42,0.08); color: #475569;
}
html.dark .uno-tag { background: rgba(255,255,255,0.10); color: #cbd5e1; }
.uno-tag--me  { background: rgba(6,182,212,0.18);   color: #0e7490; }
.uno-tag--uno { background: rgba(225,29,72,0.18);   color: #be123c; }
.uno-tag--off { background: rgba(100,116,139,0.20); color: #64748b; }
html.dark .uno-tag--me  { color: #67e8f9; }
html.dark .uno-tag--uno { color: #fda4af; }
html.dark .uno-tag--off { color: #94a3b8; }
.uno-tag--done { background: rgba(16,185,129,0.18); color: #047857; }
html.dark .uno-tag--done { color: #6ee7b7; }

/* 席位右侧的手牌「张数」：只剩 1 张时变红（提醒该喊 UNO 了） */
.uno-handcount {
  flex: none; min-width: 1.9rem; padding: .15rem .4rem; border-radius: .5rem; text-align: center;
  background: rgba(15,23,42,0.06); color: #0f172a;
  font-size: .8rem; font-weight: 800; font-variant-numeric: tabular-nums;
}
html.dark .uno-handcount { background: rgba(255,255,255,0.10); color: #fff; }
.uno-handcount.is-uno { background: rgba(225,29,72,0.16); color: #be123c; }
html.dark .uno-handcount.is-uno { color: #fda4af; }

/* 单局回顾（room.js 的 renderUnoDetail）里的弃牌小方块：只出现公开信息 */
.uno-mini {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.6rem; height: 2.1rem; padding: 0 .3rem; border-radius: .4rem;
  background: #94a3b8; color: #fff;
  font-size: .72rem; font-weight: 800; line-height: 1;
}
.uno-mini--red    { background: #e11d48; }
.uno-mini--yellow { background: #f59e0b; }
.uno-mini--green  { background: #16a34a; }
.uno-mini--blue   { background: #2563eb; }
.uno-mini--wild   { background: conic-gradient(#e11d48 0 25%, #f59e0b 0 50%, #16a34a 0 75%, #2563eb 0 100%); }

/* ---- 动效：摸牌 / 出牌（reduced-motion 下全部停掉，见文件末尾） ---- */
/* 弃牌堆顶牌外圈描一圈「当前颜色」：万能牌翻色后，这圈颜色就是本回合的有效色 */
.uno-slot .uno-card {
  box-shadow:
    0 2px 6px rgba(15,23,42,0.20),
    0 12px 26px -14px rgba(15,23,42,0.45),
    0 0 0 3px var(--uno-cur, rgba(148,163,184,0.55));
}
html.dark .uno-slot .uno-card {
  box-shadow:
    0 2px 8px rgba(0,0,0,0.55),
    0 14px 30px -16px rgba(0,0,0,0.75),
    0 0 0 3px var(--uno-cur, rgba(148,163,184,0.45));
}
/* 新打出的牌：从上方旋转落下 */
.uno-card.is-drop { animation: uno-drop-in .36s cubic-bezier(.22,1,.36,1) both; }
@keyframes uno-drop-in {
  0%   { transform: translateY(-2.4rem) rotate(-12deg) scale(1.1); opacity: 0; }
  55%  { opacity: 1; }
  100% { transform: translateY(0) rotate(0) scale(1); opacity: 1; }
}
/* 刚摸到的牌：从下方冒出来 */
.uno-card.is-enter { animation: uno-hand-in .28s ease-out both; }
@keyframes uno-hand-in {
  0%   { transform: translateY(1rem) scale(.88); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
/* 打出的那一张：向上一提、缩小淡出 */
.uno-card.is-playing { animation: uno-card-play .3s ease-in forwards; pointer-events: none; }
@keyframes uno-card-play {
  0%   { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-1.8rem) scale(.72); opacity: 0; }
}
/* 摸牌堆：点一下轻轻弹一下 */
.uno-deck.is-drawing { animation: uno-deck-bump .42s ease; }
@keyframes uno-deck-bump {
  0%   { transform: translateY(0) scale(1); }
  45%  { transform: translateY(-.4rem) scale(1.04); }
  100% { transform: translateY(0) scale(1); }
}

/* 动效偏好：停掉呼吸与悬浮位移（与 dt / chat 的 reduced-motion 同一口径） */
@media (prefers-reduced-motion: reduce) {
  .uno-uno { animation: none; }
  .uno-card, .uno-draw, .uno-deck, .uno-back { transition: none; }
  .uno-card.is-playable:hover, .uno-draw:not(:disabled):hover .uno-deck { transform: none; }
  .uno-card.is-drop, .uno-card.is-enter, .uno-card.is-playing, .uno-deck.is-drawing { animation: none; }
}

/* ============ UNO：全屏沉浸模式 ============
   #uno-stage 平时 display:contents（不产生盒子，各区块仍按原布局排布）。
   开启沉浸后（html.uno-immersive）它变成覆盖视口的固定层，整体改成竖向 flex。

   沉浸刻意「不照搬普通视图」：两张信息密度高的大卡片（#uno-status 状态条 /
   #uno-seats 出牌顺序）整体收起，换成一行 #uno-stage-head ——
     顶栏 #uno-stage-bar   只留此刻真正要紧的动态：阶段 · 轮到谁 · 方向 · 当前颜色 · 牌堆
                            + 操作按钮（聊天 / 结束 / 大厅 / 退出）
     席位 #uno-stage-seats 一排紧凑头像（剩余张数 = 角标），轮到者高亮呼吸
     牌桌 #uno-table       吃掉剩余空间、居中，铺一层「桌面」质感，轮到我时泛绿光
     手牌 #uno-hand-box    贴底，牌多则横向滚动，牌略放大
   站点头尾、返回链接都被这层盖住（背景不透明），页面锁滚动。
   与画一画同源：纯 CSS 层，不改 DOM 结构（#uno-stage 不在 .glass 内，
   不会被 backdrop-filter 变成 position:fixed 的包含块）。 */
/* --uno-pile = 两个牌堆的尺寸。普通视图一档，沉浸时在下面整体放大一档；
   弃牌堆顶的大牌（.uno-card--lg）、空位占位、牌背等都读同一个变量。 */
.uno-stage { display: contents; --uno-pile: clamp(4.5rem, 16vw, 6.5rem); }
/* 沉浸顶栏在普通视图里不存在（display:none），只在沉浸时显形 */
.uno-stage-head { display: none; }

html.uno-immersive, html.uno-immersive body { overflow: hidden; overscroll-behavior: contain; }

html.uno-immersive #uno-stage {
  position: fixed; inset: 0; z-index: 80;
  display: flex; flex-direction: column; align-items: stretch;
  gap: .5rem;
  /* 沉浸里牌堆放大一档：手更容易点中，牌桌也更像「一张桌子」 */
  --uno-pile: clamp(5rem, 20vw, 8rem);
  padding: max(.5rem, env(safe-area-inset-top)) max(.75rem, env(safe-area-inset-right))
           max(.5rem, env(safe-area-inset-bottom)) max(.75rem, env(safe-area-inset-left));
  background:
    radial-gradient(1200px 620px at 50% -12%, rgba(6,182,212,0.13), transparent 62%),
    radial-gradient(900px 520px at 92% 112%, rgba(124,58,237,0.11), transparent 60%),
    #f6f7f9;
  overflow: hidden;
}
html.dark.uno-immersive #uno-stage {
  background:
    radial-gradient(1200px 640px at 50% -12%, rgba(34,211,238,0.14), transparent 62%),
    radial-gradient(900px 540px at 92% 112%, rgba(139,92,246,0.14), transparent 60%),
    #0b1220;
}

/* 沉浸时收起普通视图的两张大卡片：信息已精简进顶栏，不再重复铺满 */
html.uno-immersive #uno-status,
html.uno-immersive #uno-seats { display: none; }

/* 各区块去掉原来的 mt-4 / mt-3 留白（间距统一交给 flex 的 gap） */
html.uno-immersive #uno-stage > * { margin-top: 0; }

/* ---- 沉浸顶栏：一行动态信息 + 一排头像席位 ---- */
html.uno-immersive .uno-stage-head { display: flex; flex-direction: column; gap: .35rem; flex: none; }

.uno-stage-bar {
  display: flex; align-items: center; gap: .45rem; flex-wrap: wrap;
  padding: .35rem .45rem; border-radius: .9rem;
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(15,23,42,0.08);
  box-shadow: 0 1px 2px rgba(15,23,42,0.05);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
html.dark .uno-stage-bar { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.09); box-shadow: none; }

/* 阶段：色点 + 文案，一眼看出「准备中 / 进行中 / 已结束」 */
.uno-stage-phase {
  display: inline-flex; align-items: center; gap: .35rem; flex: none;
  padding: .2rem .6rem; border-radius: 9999px;
  font-size: .72rem; font-weight: 700; color: #475569;
  background: rgba(148,163,184,0.18);
}
.uno-stage-phase::before {
  content: ''; width: .45rem; height: .45rem; flex: none;
  border-radius: 9999px; background: currentColor;
}
.uno-stage-phase.is-playing { background: rgba(16,185,129,0.16); color: #047857; }
.uno-stage-phase.is-waiting { background: rgba(245,158,11,0.18); color: #b45309; }
html.dark .uno-stage-phase { color: #cbd5e1; background: rgba(255,255,255,0.08); }
html.dark .uno-stage-phase.is-playing { color: #6ee7b7; background: rgba(16,185,129,0.16); }
html.dark .uno-stage-phase.is-waiting { color: #fcd34d; background: rgba(245,158,11,0.16); }

/* 轮到谁：轮到「我」时变青 + 前导呼吸点 */
.uno-stage-turn {
  min-width: 0; max-width: 13rem; font-size: .85rem; font-weight: 600; color: #334155;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.uno-stage-turn.is-me { color: #0d9488; }
html.dark .uno-stage-turn { color: #e2e8f0; }
html.dark .uno-stage-turn.is-me { color: #5eead4; }
.uno-stage-turn.is-me::before {
  content: ''; display: inline-block; width: .45rem; height: .45rem; margin-right: .3rem;
  border-radius: 9999px; background: #10b981; vertical-align: middle;
  animation: uno-turn-blink 1.6s ease-in-out infinite;
}
@keyframes uno-turn-blink { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.uno-stage-bar .uno-chip { flex: none; }
.uno-stage-actions { margin-left: auto; display: flex; align-items: center; gap: .35rem; flex: none; }
.uno-stage-actions .dt-iconbtn { width: 2.25rem; height: 2.25rem; }

/* 席位：一行紧凑头像（剩余张数 = 角标），超出横向滚动；轮到者高亮呼吸 */
.uno-stage-seats {
  display: flex; align-items: center; gap: .4rem; flex-wrap: nowrap;
  overflow-x: auto; overflow-y: hidden;
  padding: .1rem .05rem .2rem;
}
.uno-stage-seats::-webkit-scrollbar { height: 6px; }
.uno-sseat {
  display: inline-flex; align-items: center; gap: .4rem; flex: none;
  padding: .2rem .55rem .2rem .2rem; border-radius: 9999px;
  background: rgba(255,255,255,0.72); border: 1px solid rgba(15,23,42,0.08);
  transition: border-color .2s, background .2s, opacity .2s;
}
html.dark .uno-sseat { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.09); }
.uno-sseat .avatar { width: 1.75rem; height: 1.75rem; border-radius: .6rem; }
.uno-sseat.is-me .avatar { box-shadow: 0 0 0 2px rgba(6,182,212,0.55); }
html.dark .uno-sseat.is-me .avatar { box-shadow: 0 0 0 2px rgba(34,211,238,0.5); }
.uno-sseat__name {
  font-size: .78rem; font-weight: 600; color: #334155;
  max-width: 5.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
html.dark .uno-sseat__name { color: #e2e8f0; }
.uno-sseat__count {
  min-width: 1.4rem; padding: .05rem .35rem; border-radius: 9999px; text-align: center;
  font-size: .72rem; font-weight: 800; font-variant-numeric: tabular-nums;
  background: rgba(15,23,42,0.08); color: #0f172a;
}
html.dark .uno-sseat__count { background: rgba(255,255,255,0.12); color: #fff; }
.uno-sseat__count.is-uno { background: rgba(225,29,72,0.16); color: #be123c; }
html.dark .uno-sseat__count.is-uno { color: #fda4af; }
.uno-sseat__flag { font-size: .6rem; font-weight: 800; letter-spacing: .02em; color: #be123c; }
html.dark .uno-sseat__flag { color: #fda4af; }
.uno-sseat__flag.is-done { color: #047857; }
html.dark .uno-sseat__flag.is-done { color: #6ee7b7; }
.uno-sseat.is-turn {
  background: rgba(6,182,212,0.12); border-color: rgba(6,182,212,0.55);
  animation: uno-sseat-turn 1.8s ease-in-out infinite;
}
html.dark .uno-sseat.is-turn { background: rgba(34,211,238,0.14); border-color: rgba(34,211,238,0.5); }
@keyframes uno-sseat-turn {
  0%, 100% { box-shadow: 0 0 0 0 rgba(6,182,212,0); }
  50%      { box-shadow: 0 0 0 4px rgba(6,182,212,0.16); }
}
.uno-sseat.is-out { opacity: .55; }
.uno-sseat.is-spectator .uno-sseat__name { color: #64748b; }

/* 牌桌：占据剩余空间并竖直居中，铺一层「桌面」质感；空间不足时内部滚动。
   justify-content 用 safe center —— 内容比容器高时自动退回顶部对齐，
   避免「居中 + 滚动」导致的顶部被裁掉、滚不到的问题（不支持的浏览器退化为顶对齐）。 */
html.uno-immersive #uno-table {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; justify-content: safe center;
  border-radius: 1.25rem;
  -webkit-backdrop-filter: none; backdrop-filter: none;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(16,185,129,0.10), transparent 68%),
    rgba(255,255,255,0.5);
  border-color: rgba(15,23,42,0.06);
  transition: box-shadow .3s ease, border-color .3s ease, background .3s ease;
}
html.dark.uno-immersive #uno-table {
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(16,185,129,0.12), transparent 68%),
    rgba(255,255,255,0.03);
  border-color: rgba(255,255,255,0.07);
}
/* 轮到我：牌桌一圈绿光，提示「该你了」 */
html.uno-immersive #uno-table.is-my-turn {
  border-color: rgba(16,185,129,0.5);
  box-shadow: inset 0 0 0 2px rgba(16,185,129,0.28), 0 0 44px -14px rgba(16,185,129,0.55);
}

/* 手牌：贴底固定区，牌多则横向滚动；沉浸里牌略放大。
   注意：.uno-hand 一旦 overflow-x:auto，按 CSS 规范「另一轴的 visible 会算成 auto」，
   于是纵向也会被整体裁切 —— 而「可出」高亮是 outline 3px + offset 2px（外扩 5px），
   hover 又把牌抬起 0.4rem，两者都落在牌面之外。padding 必须留够，
   否则高亮会被上/下/左右切掉一截（沉浸时牌多、只有一行，最明显）。 */
html.uno-immersive #uno-hand-box { flex: none; }
html.uno-immersive #uno-hand-box .uno-hand {
  flex-wrap: nowrap; overflow-x: auto;
  padding: .8rem .4rem .6rem;   /* 上 ≥ hover 抬手 + 圈；左右 / 下 ≥ 圈，别裁到高亮 */
}
html.uno-immersive #uno-hand-box .uno-card { --uno-w: clamp(3.4rem, 12vw, 4.8rem); }

/* 观战 / 结算提示：固定不伸缩 */
html.uno-immersive #uno-spectator,
html.uno-immersive #uno-finished { flex: none; }

/* 只能摸牌时（本回合没牌可出）：让摸牌堆轻轻呼吸，把视线引过去（普通视图同样生效） */
.uno-draw.is-hint:not(:disabled) { border-radius: 1rem; animation: uno-draw-hint 1.7s ease-in-out infinite; }
@keyframes uno-draw-hint {
  0%, 100% { box-shadow: 0 0 0 0 rgba(6,182,212,0); }
  50%      { box-shadow: 0 0 0 6px rgba(6,182,212,0.18); }
}

/* 沉浸层（z-80）盖住了右下角聊天气泡 → 隐藏它（入口改用顶栏的聊天按钮）；
   聊天抽屉抬到 z-90（高于沉浸层、低于确认弹窗 z-100）。 */
html.uno-immersive .chat-fab { display: none; }
html.uno-immersive .chat--game .chat-panel { z-index: 90; }
/* 沉浸层盖住整个页面，轻提示（toast z-50）会被压在底下 → 抬到沉浸层之上 */
html.uno-immersive .room-toast { z-index: 95; }

/* 沉浸里聊天抽屉改成右侧通栏玻璃面板（宽屏）；窄屏仍走 bottom-sheet（见聊天区的媒体查询） */
@media (min-width: 641px) {
  html.uno-immersive .chat--game .chat-panel {
    top: .5rem; right: .5rem; bottom: .5rem;
    width: min(20rem, calc(100vw - 1rem)); max-height: none;
  }
  html.uno-immersive .chat--game .chat-body { height: auto; flex: 1 1 auto; }
}

/* 沉浸里停掉呼吸 / 呼吸环（与 dt / chat 的 reduced-motion 同一口径） */
@media (prefers-reduced-motion: reduce) {
  .uno-stage-turn.is-me::before,
  .uno-sseat.is-turn,
  .uno-draw.is-hint:not(:disabled) { animation: none; }
}

/* ============ UNO：喊 UNO 的全屏特效 ============
   谁喊了 UNO 完全由服务端 state 的 called_uno 决定（uno-panel.js 只负责在
   「false→true」的那一下点亮一次），本层不判任何规则、纯视觉。
   固定铺满视口、pointer-events:none —— 不挡任何操作（沉浸里的按钮 / 手牌都还能点）。
   z-index 96：压住沉浸层(80) / 聊天抽屉(90) / 轻提示(95)，但把确认弹窗(100)留在最上。
   is-on 由 JS 在约 2.2s 后摘掉，动画随之复位。 */
.uno-burst {
  position: fixed; inset: 0; z-index: 96;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .4rem;
  pointer-events: none;
  opacity: 0; visibility: hidden; overflow: hidden;
  background:
    radial-gradient(58% 46% at 50% 46%, rgba(225,29,72,0.34), rgba(15,23,42,0.62) 74%),
    radial-gradient(92% 72% at 50% 50%, rgba(245,158,11,0.16), transparent 70%);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
/* 自己喊的：换成青紫调，一眼区分「我」和「别人」 */
.uno-burst.is-me {
  background:
    radial-gradient(58% 46% at 50% 46%, rgba(6,182,212,0.34), rgba(15,23,42,0.66) 74%),
    radial-gradient(92% 72% at 50% 50%, rgba(124,58,237,0.20), transparent 70%);
}
.uno-burst.is-on { visibility: visible; animation: uno-burst-fade 2.2s ease both; }
@keyframes uno-burst-fade {
  0%   { opacity: 0; }
  10%  { opacity: 1; }
  80%  { opacity: 1; }
  100% { opacity: 0; }
}

/* 转动的虚线光环：从中心炸开、边转边放大淡出 */
.uno-burst__ring {
  position: absolute; left: 50%; top: 50%;
  width: min(74vmin, 34rem); aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px dashed rgba(255,255,255,0.42);
  box-shadow: inset 0 0 60px rgba(255,255,255,0.14);
}
.uno-burst.is-on .uno-burst__ring { animation: uno-burst-ring 2.2s ease-out both; }
@keyframes uno-burst-ring {
  0%   { transform: translate(-50%, -50%) scale(.28) rotate(0);     opacity: 0; }
  18%  { opacity: .95; }
  100% { transform: translate(-50%, -50%) scale(1.55) rotate(210deg); opacity: 0; }
}

/* 四色小方块沿径向炸开（节点由 uno-panel.js 生成，--a 角向 / --d 距离 / --c 颜色） */
.uno-burst__sparks { position: absolute; inset: 0; }
.uno-burst__spark {
  position: absolute; left: 50%; top: 50%;
  width: .55rem; height: 1.05rem;
  margin: -.525rem 0 0 -.275rem;   /* 先把自己对到视口中心（keyframes 会覆盖 transform） */
  border-radius: .18rem; background: var(--c, #fff);
  box-shadow: 0 0 8px rgba(255,255,255,0.35);
  opacity: 0;
}
.uno-burst.is-on .uno-burst__spark { animation: uno-burst-spark 1.25s cubic-bezier(.16,.84,.3,1) both; }
@keyframes uno-burst-spark {
  0%   { transform: rotate(var(--a, 0deg)) translateY(0) scaleX(.5); opacity: 0; }
  12%  { opacity: 1; }
  70%  { opacity: 1; }
  100% { transform: rotate(var(--a, 0deg)) translateY(calc(-1 * var(--d, 40vmin))) scaleX(1); opacity: 0; }
}

/* 主字 UNO：弹性放大砸下、轻微摆动停留、末尾再放大淡出 */
.uno-burst__word {
  position: relative;
  font-size: clamp(4.5rem, 24vw, 13rem);
  font-weight: 900; font-style: italic; line-height: .85;
  letter-spacing: .02em; color: #fff;
  text-shadow:
    0 0 22px rgba(255,255,255,0.55),
    0 .05em 0 #be123c,
    0 .1em 0 #881337,
    0 .16em .28em rgba(0,0,0,0.5);
  transform-origin: 50% 58%;
}
.uno-burst.is-on .uno-burst__word { animation: uno-burst-word 2.2s cubic-bezier(.2,.9,.25,1.25) both; }
@keyframes uno-burst-word {
  0%   { transform: rotate(-15deg) scale(.15); opacity: 0; }
  20%  { transform: rotate(-6deg) scale(1.18); opacity: 1; }
  34%  { transform: rotate(-5deg) scale(.94); }
  48%  { transform: rotate(-5deg) scale(1.05); }
  64%  { transform: rotate(-5deg) scale(1); opacity: 1; }
  86%  { transform: rotate(-5deg) scale(1); opacity: 1; }
  100% { transform: rotate(-5deg) scale(1.1); opacity: 0; }
}

/* 是谁喊的：小胶囊，稍晚一点浮上来 */
.uno-burst__who {
  position: relative; margin: 0;
  padding: .32rem .95rem; border-radius: 9999px;
  background: rgba(15,23,42,0.55); color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
  font-size: clamp(.85rem, 3.2vw, 1.05rem); font-weight: 700;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transform: translateY(.8rem); opacity: 0;
}
.uno-burst.is-on .uno-burst__who { animation: uno-burst-who 2.2s ease both; }
@keyframes uno-burst-who {
  0%, 30% { transform: translateY(.8rem); opacity: 0; }
  45%     { transform: translateY(0);     opacity: 1; }
  82%     { transform: translateY(0);     opacity: 1; }
  100%    { transform: translateY(0);     opacity: 0; }
}

/* 动效偏好：收掉炸开的碎片与光环，只留一次简洁的整层淡入淡出（仍能看清是谁喊的） */
@media (prefers-reduced-motion: reduce) {
  .uno-burst.is-on .uno-burst__ring,
  .uno-burst.is-on .uno-burst__spark { display: none; }
  .uno-burst.is-on .uno-burst__word { animation: none; transform: rotate(-5deg) scale(1); opacity: 1; }
  .uno-burst.is-on .uno-burst__who  { animation: none; transform: none; opacity: 1; }
}
