/* §4 牌桌外壳：参照牌桌没有 H5 文字顶栏。
   本轮采用「视觉最小化悬浮返回按钮」：只保留一个深色半透明小圆钮，不占横条；
   postMessage / handoff / protocol 字段与消息名全部不动。 */
.table-shell {
  position: relative;
  min-height: 100dvh;
  background: #10513F;
  color: #F4F8F6;
}
.table-topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 110;
  height: 0; min-height: 0; padding: 0;
  background: transparent; border: 0; pointer-events: none;
}
.table-topbar__back {
  /* T-UI-02：原 top:12px 与 Cocos 汉堡（5%H）重叠。下移到 10%H 且至少 64px，
     Cocos 侧汉堡坐标保持参照 §4.2.1 的 (2.4%W,5%H) 不动，净空 >8px。 */
  position: absolute;
  top: max(calc(64px + env(safe-area-inset-top)), 10dvh); left: 12px;
  display: grid; place-items: center; width: 36px; height: 36px; padding: 0;
  border: 1px solid rgba(255, 255, 255, .18); border-radius: 50%;
  background: rgba(4, 26, 20, .55); color: rgba(244, 248, 246, .9);
  backdrop-filter: blur(4px); pointer-events: auto;
  transition: opacity .12s ease, transform .12s ease;
}
.table-topbar__back:active { opacity: .75; transform: translateY(1px); }
.table-topbar__back-ico { display: block; width: 20px; height: 20px; }
.table-topbar__title, .table-topbar__hint { display: none; }
.table-stage {
  position: relative;
  min-height: 100dvh;
  display: grid; place-items: center;
  overflow: hidden;
}

/* 骨架屏：不透明背景先于 iframe 渲染，绝不白屏。
   §4.1.2 的 16 条毛毡色带在 CSS 侧等价为 17 个 6.25% 色标；
   §4.1.3 的中心 alpha 0.05 高光用 radial-gradient 叠加，无位图。 */
.table-skeleton {
  position: absolute; inset: 0; z-index: 2;
  display: grid; place-content: center; justify-items: center;
  gap: 22px; padding: 24px;
  background: #10513F;
  transition: opacity 150ms ease;
}
.table-skeleton::before {
  content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(circle at 50% 45%, rgba(255, 255, 255, .05) 0%, rgba(255, 255, 255, 0) 55%);
}
.table-skeleton.is-hidden { opacity: 0; pointer-events: none; }
.table-skeleton.has-error { filter: saturate(.7); }
.table-skeleton__felt {
  position: absolute; inset: 0; z-index: 0;
  width: 100%; height: 100%; border: 0; border-radius: 0; box-shadow: none;
  background: linear-gradient(180deg,
    #10513F 0%,
    #115B47 6.25%,
    #12654F 12.5%,
    #137058 18.75%,
    #147A60 25%,
    #168568 31.25%,
    #189071 37.5%,
    #1B9B79 43.75%,
    #189171 50%,
    #138265 56.25%,
    #0F7258 62.5%,
    #0B634B 68.75%,
    #085B45 75%,
    #075640 81.25%,
    #06503B 87.5%,
    #054B36 93.75%,
    #034531 100%);
}
.skeleton-seat {
  position: absolute; z-index: 2;
  width: clamp(34px, 6vw, 56px); height: clamp(34px, 6vw, 56px);
  border-radius: 50%; border: 2px dashed rgba(226, 244, 234, .55);
  background: rgba(0, 0, 0, .08);
}
.skeleton-seat:nth-child(1) { left: 47%; top: 11%; }
.skeleton-seat:nth-child(2) { left: 34%; top: 23%; }
.skeleton-seat:nth-child(3) { right: 34%; top: 23%; }
.skeleton-seat:nth-child(4) { left: 34%; bottom: 26%; }
.skeleton-seat:nth-child(5) { right: 34%; bottom: 26%; }
.skeleton-seat:nth-child(6) { left: 47%; bottom: 12%; }
.table-skeleton__mark {
  position: absolute; inset: 0; z-index: 2;
  display: grid; place-items: center;
  font-size: clamp(72px, 22vw, 220px); line-height: 1;
  color: rgba(244, 248, 246, .10);
}
.table-skeleton__bar {
  position: relative; z-index: 3;
  width: min(360px, 80vw); height: 4px; border-radius: 999px; overflow: hidden;
  background: rgba(255, 255, 255, .12);
}
.table-skeleton__bar i { display: block; width: 8%; height: 100%; border-radius: inherit; background: #7EF7CA; transition: width 180ms ease; }
.table-skeleton__status {
  position: relative; z-index: 3; min-height: 20px;
  color: rgba(226, 244, 234, .72); font-size: 14px; text-align: center;
}
.table-skeleton__actions { position: relative; z-index: 3; display: flex; gap: 10px; }

/* iframe 宿主：手机竖/横屏全屏覆盖，PC 同样铺满视口（协议与尺寸不动）。
   注意：不要用 grid + place-items:center 给 iframe 定位——grid item 在
   justify-items:center 下会退化成 shrink-to-fit，刷新时若样式还没完全生效，
   iframe 会先按内容宽度（约 300px）落位并让 Cocos 锁死这个尺寸，
   表现就是「牌桌缩在屏幕中间、上下大片黑」。改用绝对定位彻底消除这个分支。 */
#table-frame-host {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  overflow: hidden;
  /* T-UI-02：取消 PC 深绿卡片宿主底，改为与毛毡顶端同色，无深绿描边观感。 */
  background: #10513F;
}
#table-frame-host:has(#poker-table) { display: block; }
/* 预热态：iframe 已经在跑（下载引擎、建场景），但玩家还在大厅。
   宿主必须整层透明且不接点击，否则会盖住大厅；iframe 自身也不留毛毡底。 */
#table-frame-host[data-prewarm="1"] { background: transparent; pointer-events: none; }
#table-frame-host[data-prewarm="1"] #poker-table { background: transparent; }
#poker-table {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #10513F;
  opacity: 0;
  transition: opacity 150ms ease;
}
#poker-table.is-visible { opacity: 1; }
@media (min-width: 901px) {
  /* T-UI-02：PC 也铺满视口——不居中卡片、不限宽、不锁比例、不圆角、不投影。
     毛毡由 Cocos 全屏绘制（REFERENCE_RESTORE_SPEC §4.1），卡片裁切即桌沿残留。 */
  #poker-table {
    width: 100%;
    height: 100%;
    max-height: none;
    aspect-ratio: auto;
    border-radius: 0;
    box-shadow: none;
  }
}
