/* 灵动岛侧保持安全距离，另一侧40px；所有页面由 screen-layout.js 分别提供左右边距。 */
html.unified-layout {
  --edge-gap: 40px;
  --page-edge-left: var(--layout-left);
  --page-edge-right: var(--layout-right);
  --seat-edge-left: var(--layout-left);
  --seat-edge-right: var(--layout-right);
}

/* 统一定位父级坐标：不再由 body、画布和控件各加一次安全区。 */
html.unified-layout body,
html.unified-layout #app,
html.unified-layout #table,
html.unified-layout #bottom {
  padding-left: 0 !important;
  padding-right: 0 !important;
}
html.unified-layout #app { position: relative; }
@media (orientation: portrait) {
  html.unified-layout #app { position: fixed; }
}
html.unified-layout.ios-standalone #app { position: fixed; }

html.unified-layout .seat.pos-left { left: 0 !important; right: auto !important; }
html.unified-layout .seat.pos-right { right: 0 !important; left: auto !important; }
html.unified-layout .pos-left .seat-head { left: var(--layout-left); }
html.unified-layout .pos-right .seat-head { right: var(--layout-right); }
html.unified-layout .pos-left .seat-play { left: calc(var(--layout-left) + 86px); }
html.unified-layout .pos-right .seat-play { right: calc(var(--layout-right) + 86px); }

html.unified-layout #bottom .pos-bottom {
  left: var(--layout-left) !important;
  padding-left: 0;
  margin-left: 0;
}
html.unified-layout .seat.pos-bottom .avatar { margin-left: 0 !important; }
html.unified-layout .seat.pos-bottom .quick-chat-bubble { left: 0; }
html.unified-layout .table-topbar {
  left: 0;
  right: 0;
  padding-left: var(--layout-left);
  padding-right: var(--layout-right);
}
html.unified-layout #actions { right: 0; }
html.unified-layout #teams,
html.unified-layout .teams,
html.unified-layout #score,
html.unified-layout #scoreBox,
html.unified-layout .score-box { left: var(--layout-left) !important; }
html.unified-layout #counter,
html.unified-layout #quickChat { right: var(--layout-right) !important; }

html.unified-layout #btnHandSize {
  right: calc(var(--layout-right) + var(--quick-chat-button-size) + 10px + 36px + 10px) !important;
}

/* 页面内容外缘和两侧头像对齐；移除旧内容宽度上限造成的额外留白。 */
html.unified-layout #homeLayer,
html.unified-layout #roomLayer,
html.unified-layout #matchResultLayer {
  left: 0;
  right: 0;
  padding-left: var(--layout-left);
  padding-right: var(--layout-right);
}
html.unified-layout #homeLayer .home-box,
html.unified-layout #roomLayer .room-box,
html.unified-layout #roomLayer .room-lobby,
html.unified-layout #roomLayer .room-in,
html.unified-layout #matchResultLayer .match-result-card {
  width: 100%;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}
html.unified-layout #homeLayer .home-box,
html.unified-layout #roomLayer .room-box { padding-left: 0; padding-right: 0; }
html.unified-layout #homeLayer > .settings-icon-trigger,
html.unified-layout #roomLayer > .settings-icon-trigger,
html.unified-layout #roomLayer > #roomJoinOtherBtn { right: var(--layout-right); }
html.unified-layout #homeLayer > .fullscreen-trigger,
html.unified-layout #roomLayer > .fullscreen-trigger { right: calc(var(--layout-right) + 48px); }

/* 居中组件补偿网页之外的状态栏，使用物理屏幕中线。 */
html.unified-layout #handWrap { left: 0 !important; }
html.unified-layout #handWrap:not(.scrollable) #hand { left: calc(50% + var(--layout-center-offset)) !important; }
html.unified-layout #actionCenter .turn-timer.in-row { left: calc(50% + var(--layout-center-offset)) !important; }

html.unified-layout #myPlay,
html.unified-layout #app #centerHint { left: calc(50% + var(--layout-center-offset)); }
html.unified-layout #actionCenter #btnHint {
  right: calc(50% - var(--layout-center-offset) + 25px) !important;
}
html.unified-layout #actionCenter #btnPlay,
html.unified-layout #actionCenter #btnReturn,
html.unified-layout #actionCenter #btnNoBeat {
  left: calc(50% + var(--layout-center-offset) + 25px) !important;
}
html.unified-layout #actionCenter:has(#btnPass:not(.hidden)) #btnHint {
  left: calc(50% + var(--layout-center-offset) + 25px) !important;
  right: auto !important;
}
html.unified-layout #actionCenter:has(#btnPass:not(.hidden)) #btnPlay {
  left: calc(50% + var(--layout-center-offset) + 110px) !important;
}
html.unified-layout #actionCenter:has(#btnPass:not(.hidden)) #btnPass {
  right: calc(50% - var(--layout-center-offset) + 25px) !important;
}
/* 结算操作组的 fixed 子元素相对这个有 transform 的容器定位，只平移父级一次。 */
html.unified-layout #actionCenter.finish-layout {
  left: calc(50% + var(--layout-center-offset)) !important;
}
