/* Reversible interface preview. Every presentation change is opt-in; existing artwork is retained. */
.player-roster-toggle { display: none; }
:root[data-ui-profile="preview"] {
  --ui-surface: #142733;
  --ui-surface-raised: #1d3441;
  --ui-surface-inset: #0c1d28;
  --ui-border: #435d6b;
  --ui-border-soft: #344c5a;
  --ui-text: #eef4f6;
  --ui-muted: #b6c8d2;
  --ui-accent: #edc983;
  --ui-focus: #a4e6f6;
  --ui-radius: 14px;
  --ui-shadow: 0 12px 32px #030b143d;
  --gold: var(--ui-accent);
  --muted: var(--ui-muted);
}

[data-ui-profile="preview"] body { color: var(--ui-text); }
[data-ui-profile="preview"] :is(button, input, select, summary, a) { -webkit-tap-highlight-color: #edc98333; }
[data-ui-profile="preview"] :is(button, input, select, summary, a, [tabindex]):focus-visible {
  outline: 3px solid var(--ui-focus);
  outline-offset: 3px;
}
[data-ui-profile="preview"] .front-screen h1[tabindex="-1"]:focus { outline: none; }
[data-ui-profile="preview"] .world-top h1[tabindex="-1"]:focus { outline: none; }
[data-ui-profile="preview"] :is(button, select) { min-height: 40px; }
[data-ui-profile="preview"] button { line-height: 1.3; }
[data-ui-profile="preview"] :is(input, select) { border-color: #66818e; }
[data-ui-profile="preview"] .online input:is(:not([type]), [type="text"], [type="email"], [type="password"], [type="search"], [type="number"], [type="tel"], [type="url"]) { min-height: 44px; background: var(--ui-surface-inset); }
[data-ui-profile="preview"] .online :is(p, label) { line-height: 1.5; }
[data-ui-profile="preview"] :is(.help-inline, .muted) { color: var(--ui-muted); }
[data-ui-profile="preview"] dialog {
  border-color: #748b95;
  border-radius: 18px;
  box-shadow: 0 22px 80px #02081080;
  max-height: calc(100svh - 32px);
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
[data-ui-profile="preview"] dialog .close { min-width: 40px; min-height: 40px; line-height: 1; }
[data-ui-profile="preview"] dialog :is(button, select) { min-height: 44px; }
[data-ui-profile="preview"] :is(#accountDialog, #guardianDialog) { overflow-y: auto; }

/* Front door and home retain their globe artwork and familiar gold accents. */
[data-ui-profile="preview"] .online header { gap: 16px; }
[data-ui-profile="preview"] .front-screen { padding-inline: clamp(18px, 3.5vw, 44px); }
[data-ui-profile="preview"] .online #landingScreen { gap: clamp(28px, 5vw, 70px); }
[data-ui-profile="preview"] .landing-login { max-width: 440px; }
[data-ui-profile="preview"] #landingScreen .account-card { padding: clamp(22px, 2.4vw, 30px); border-color: #526d7b; }
[data-ui-profile="preview"] #landingScreen #accountStatus { margin-top: 0; font-size: 21px; font-weight: 600; }
[data-ui-profile="preview"] #emailLogin { display: grid; grid-template-columns: 1fr 1fr; column-gap: 10px; }
[data-ui-profile="preview"] #emailLogin :is(label, input, [type="submit"]) { grid-column: 1 / -1; }
[data-ui-profile="preview"] #emailLogin button { margin-right: 0; }
[data-ui-profile="preview"] #emailLogin :is(#registerAccount, #recoverAccount) { padding-inline: 8px; font-size: 13px; }
[data-ui-profile="preview"] #guestContinue { min-height: 48px; }
[data-ui-profile="preview"] .online #menuScreen { padding-bottom: 80px; gap: 24px; }
[data-ui-profile="preview"] .online #menuScreen > .menu-heading h1 { font-size: clamp(32px, 3.4vw, 44px); }
[data-ui-profile="preview"] :is(.lobby-card, .social-home, .lobby-details) { border-color: var(--ui-border-soft); border-radius: var(--ui-radius); box-shadow: var(--ui-shadow); }
[data-ui-profile="preview"] .online #menu .lobby-card { padding: 24px; }
[data-ui-profile="preview"] :is(.public-card, .online #menu .lobby-card) h2 { margin-top: 0; }
[data-ui-profile="preview"] :is(.public-card, .online #menu .lobby-card) p { color: var(--ui-muted); }
[data-ui-profile="preview"] .public-card { padding: 26px; border-color: #778167; box-shadow: var(--ui-shadow); }
[data-ui-profile="preview"] .public-card > button { min-height: 48px; flex-shrink: 0; }
[data-ui-profile="preview"] .home-host-actions { gap: 12px; }
[data-ui-profile="preview"] :is(.map-maker-link, .home-host-actions > #openEconomy) { border-radius: 10px; min-height: 44px; }
[data-ui-profile="preview"] .social-home { padding: 22px; background: #122632e8; }
[data-ui-profile="preview"] .social-heading h2 { font-size: 23px; }
[data-ui-profile="preview"] .social-person { gap: 8px; padding-block: 11px; }
[data-ui-profile="preview"] .social-person button { min-height: 36px; }
[data-ui-profile="preview"] .social-links { margin-top: 18px; }
[data-ui-profile="preview"] #joinCode { font-variant-numeric: tabular-nums; letter-spacing: .08em; }

/* Room setup keeps its existing sections and persistent action footer. */
[data-ui-profile="preview"] #createDialog { padding: 24px; background: var(--ui-surface); }
[data-ui-profile="preview"] #createDialog[open] { gap: 20px; }
[data-ui-profile="preview"] .creation-heading { gap: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--ui-border-soft); }
[data-ui-profile="preview"] .creation-heading h2 { font-size: 28px; }
[data-ui-profile="preview"] .creation-identity { gap: 16px; }
[data-ui-profile="preview"] #createDialog .creation-preview { padding: 18px; border-radius: 12px; }
[data-ui-profile="preview"] .creation-preview figcaption { line-height: 1.5; }
[data-ui-profile="preview"] .creation-world { padding: 18px; border-color: var(--ui-border); background: var(--ui-surface-raised); }
[data-ui-profile="preview"] .creation-rules { gap: 18px; padding-top: 20px; }
[data-ui-profile="preview"] #createDialog :is(.match-options, .bank-options) { padding: 16px; border-color: var(--ui-border-soft); background: #0c1d2866; }
[data-ui-profile="preview"] #createDialog .help-inline { line-height: 1.5; }
[data-ui-profile="preview"] #phaseTimers summary { min-height: 36px; display: flex; align-items: center; }
[data-ui-profile="preview"] .creation-footer { bottom: -24px; padding: 16px 0 8px; gap: 10px; background: #142733fa; border-color: #536e7c; }
[data-ui-profile="preview"] #createDialog #create { min-width: 148px; }
[data-ui-profile="preview"] #createDialog #createStatus { line-height: 1.4; }

/* Browser details remain compact; DOM order is owned by the browser module. */
[data-ui-profile="preview"] .online #roomsDialog { overflow-y: auto; padding: 26px; }
[data-ui-profile="preview"] .browser-tools { padding: 16px; gap: 12px; border-color: var(--ui-border); background: var(--ui-surface); }
[data-ui-profile="preview"] .browser-check { min-height: 36px; }
[data-ui-profile="preview"] .browser-check input { min-height: 18px; width: 18px; height: 18px; flex-shrink: 0; }
[data-ui-profile="preview"] .browser-content { gap: 16px; margin-top: 16px; }
[data-ui-profile="preview"] .browser-table-wrap { border-color: var(--ui-border); }
[data-ui-profile="preview"] .browser-table th { font-size: 12px; letter-spacing: .02em; }
[data-ui-profile="preview"] .browser-table td { padding: 8px 10px; }
[data-ui-profile="preview"] .browser-table button { min-height: 40px; padding: 8px 5px; }
[data-ui-profile="preview"] .browser-table tr.selected { background: #314e5a; box-shadow: inset 4px 0 var(--ui-accent); }
[data-ui-profile="preview"] .browser-detail { padding: 18px; border-color: var(--ui-border); }
[data-ui-profile="preview"] .browser-detail h3 { margin-bottom: 14px; line-height: 1.35; }
[data-ui-profile="preview"] .browser-detail dl { grid-template-columns: minmax(70px, .85fr) minmax(0, 1fr); gap: 9px 12px; margin-bottom: 0; }
[data-ui-profile="preview"] .browser-detail dd { text-align: right; }
[data-ui-profile="preview"] .browser-detail [data-join] { margin: 0 0 18px; }

/* Lobby hierarchy: players and ready actions first, rules easy to scan. */
[data-ui-profile="preview"] .online #lobbyScreen { padding-top: 30px; }
[data-ui-profile="preview"] .online #lobbyTitle { font-size: clamp(29px, 3.5vw, 38px); line-height: 1.2; margin-top: 0; }
[data-ui-profile="preview"] .online #lobbyDescription { margin-top: 0; }
[data-ui-profile="preview"] .lobby-layout { gap: 20px; margin-top: 22px; }
[data-ui-profile="preview"] .online #lobbyScreen #match { padding: 22px; background: linear-gradient(145deg, #1c3440, #142731); }
[data-ui-profile="preview"] .online #lobbyScreen #presence { gap: 8px; margin-bottom: 18px; }
[data-ui-profile="preview"] .lobby-player { gap: 10px; padding: 12px; }
[data-ui-profile="preview"] .lobby-player strong { flex: 1 1 110px; }
[data-ui-profile="preview"] .lobby-player select { min-height: 38px; max-width: 114px; font-size: 12px; }
[data-ui-profile="preview"] .lobby-player button { min-height: 38px; font-size: 12px; padding: 8px 10px; }
[data-ui-profile="preview"] .lobby-details { padding: 22px; background: var(--ui-surface); }
[data-ui-profile="preview"] .lobby-details dl { gap: 0; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); }
[data-ui-profile="preview"] .lobby-details :is(dt, dd) { padding-block: 9px; border-bottom: 1px solid #3d566344; line-height: 1.4; }
[data-ui-profile="preview"] .lobby-details dd { padding-left: 12px; }
[data-ui-profile="preview"] .lobby-footer { flex-wrap: wrap; }
[data-ui-profile="preview"] .online #lobbyScreen .invite-row { gap: 12px; }
[data-ui-profile="preview"] .invite-buttons button { min-height: 40px; font-size: 12px; padding: 9px 11px; }

/* The board remains visually open; the rotation arc follows its upper-right rim. */
[data-ui-profile="preview"] .board-column { container: worldbound-board / inline-size; }
[data-ui-profile="preview"] .board-column > .world { overflow: clip; }
@media (min-width: 721px) {
  [data-ui-profile="preview"] .online #gameShell,
  [data-ui-profile="preview"] body:not(.online) > main:has(.board-column) { grid-template-columns: minmax(0,1fr) clamp(280px,26vw,340px); }
}
[data-ui-profile="preview"] .board-column .world-top,
[data-ui-profile="preview"] .online #gameShell .world-top { max-width: calc(50% - 92px) !important; left: 18px; top: 18px; }
[data-ui-profile="preview"] .board-column .world-top h1,
[data-ui-profile="preview"] .online #gameShell .world-top h1 { font-size: clamp(22px, 2.1vw, 30px); line-height: 1.2; margin: 0 0 8px; color: #fff0cf; text-shadow: 0 2px 12px #07131a; }
[data-ui-profile="preview"] .board-column .world-top p { color: #cadbe2; font-size: 12px; text-wrap: pretty; }
[data-ui-profile="preview"] .world > .player-list { width: 186px; padding: 6px; border-color: #53707e; background: #102633e8; }
[data-ui-profile="preview"] .player-list .player-row { padding: 5px 6px; }
[data-ui-profile="preview"] .player-list .player-name { font-size: 12px; }
[data-ui-profile="preview"] .player-list .player-stats { font-size: 10px; }
[data-ui-profile="preview"] .player-more > summary { min-height: 24px; min-width: 28px; display: flex; align-items: center; justify-content: center; }
[data-ui-profile="preview"] .player-options button { min-height: 36px; }
[data-ui-profile="preview"] .world > .board-bank { width: 252px; padding: 9px; border-color: #53707e; background: #102633e8; }
[data-ui-profile="preview"] .board-bank .bank-stacks { gap: 5px; padding: 0; }
[data-ui-profile="preview"] .board-bank .bank-stack { height: 60px; }
[data-ui-profile="preview"] .board-bank .bank-heading { margin-bottom: 7px !important; }
[data-ui-profile="preview"] .board-column .view-controls { gap: 6px; bottom: 15px; max-width: calc(100% - 540px); }
[data-ui-profile="preview"] .board-column .view-controls button { min-height: 38px; padding: 8px 10px; font-size: 12px; }
[data-ui-profile="preview"] .online #onlinePanel { padding: 10px; background: #10232d; }
[data-ui-profile="preview"] .online #onlinePanel #match { padding: 12px; border-color: var(--ui-border-soft); background: linear-gradient(145deg, #1c3440, #142731); }
[data-ui-profile="preview"] .online #onlinePanel #turn { font-size: 18px; line-height: 1.4; margin: 0 0 16px; }
[data-ui-profile="preview"] .room-actions .build-piece { min-height: 68px; padding: 12px 26px 19px 12px; border-radius: 9px; }
[data-ui-profile="preview"] .build-piece.active { border-color: #f4d28c; background: #474632; box-shadow: inset 3px 0 #f4d28c; }
[data-ui-profile="preview"] .build-piece small { font-size: 11px; }
[data-ui-profile="preview"] .build-unavailable { color: #ccd8df; }
[data-ui-profile="preview"] .board-end-turn { min-height: 44px; }

/* Original hand layout is retained; polish only the card-detail dialogs. */
[data-ui-profile="preview"] .action-card-dialog { padding: 28px; }
[data-ui-profile="preview"] .action-card-detail { gap: 22px; align-items: flex-start; }
[data-ui-profile="preview"] .action-card-detail > .action-card-art { width: 130px; height: 182px; flex-shrink: 0; }
[data-ui-profile="preview"] .action-card-detail p { line-height: 1.6; }
[data-ui-profile="preview"] .resource-picker { gap: 12px; }
[data-ui-profile="preview"] .resource-picker-count button { min-width: 40px; min-height: 40px; }
[data-ui-profile="preview"] .action-card-footer { border-top: 1px solid var(--ui-border-soft); padding-top: 16px; }

/* Trading keeps the two visible sides and existing card art. */
[data-ui-profile="preview"] .trade-dialog { padding: 26px; }
[data-ui-profile="preview"] .trade-columns { gap: 20px; }
[data-ui-profile="preview"] .trade-pool { border-color: #66818f; background: #0d202c; }
[data-ui-profile="preview"] .trade-column .source-label { font-weight: 600; letter-spacing: .03em; }
[data-ui-profile="preview"] .card-source { gap: 8px; }
[data-ui-profile="preview"] .card-source .resource-card { min-height: 116px; border-radius: 8px; }
[data-ui-profile="preview"] .trade-footer { padding-top: 16px; gap: 10px; }
[data-ui-profile="preview"] .trade-footer button { min-height: 44px; }
[data-ui-profile="preview"] .trade-error { padding-top: 8px; }
[data-ui-profile="preview"] .bank-rates summary { min-height: 40px; display: flex; align-items: center; }

/* Constrained options and consistent secondary dialogs. */
[data-ui-profile="preview"] .options-menu > summary { min-width: 44px; min-height: 44px; display: grid; place-items: center; padding: 8px 10px; }
[data-ui-profile="preview"] .options-panel { width: min(304px, calc(100vw - 24px)); max-height: calc(100svh - 112px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 12px; gap: 8px; border-color: #7b929d; background: #10232efc; box-shadow: 0 16px 48px #020911a8; }
[data-ui-profile="preview"] .options-panel > :is(a, button),
[data-ui-profile="preview"] .options-panel .sound-toggle { min-height: 44px; padding: 11px 12px; border-radius: 8px; }
[data-ui-profile="preview"] .options-panel #leaveConfirm { padding: 12px; border: 1px solid #b17c78; border-radius: 9px; background: #352b32; }
[data-ui-profile="preview"] .options-panel #leaveConfirm p { margin-top: 0; line-height: 1.5; }
[data-ui-profile="preview"] .options-panel #leaveConfirm button { min-height: 44px; }
[data-ui-profile="preview"] #economyDialog { width: min(760px, calc(100vw - 28px)); }
[data-ui-profile="preview"] #economyDialog #economy { padding: 26px; }
[data-ui-profile="preview"] .economy-heading { align-items: flex-start; }
[data-ui-profile="preview"] .economy-heading h2 { font-size: 28px; padding-right: 0; }
[data-ui-profile="preview"] .subscription-grid { gap: 12px; }
[data-ui-profile="preview"] .subscription-card { padding: 18px; background: var(--ui-surface); border-color: var(--ui-border); }
[data-ui-profile="preview"] #shop > p { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 16px; border: 1px solid var(--ui-border-soft); border-radius: 10px; background: #0c1d2877; }
[data-ui-profile="preview"] #inventory > p { padding: 12px 14px; border-bottom: 1px solid var(--ui-border-soft); overflow-wrap: anywhere; }
[data-ui-profile="preview"] #guardianDialog { padding: 28px; }
[data-ui-profile="preview"] #guardianDialog h2 { margin-top: 0; }
[data-ui-profile="preview"] #guardianDialog #guardianContinue { display: block; width: 100%; }
[data-ui-profile="preview"] #guardianDialog #youngGuest { width: 100%; margin-top: 20px; }

@container worldbound-board (max-width: 960px) {
  [data-ui-profile="preview"] .board-column .view-controls { bottom: 15px; max-width: 210px; }
}

@container worldbound-board (max-width: 620px) {
  [data-ui-profile="preview"] .world-heading-controls { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; position: absolute; top: 18px; left: 12px; width: calc(100% - 190px); z-index: 3; pointer-events: none; }
  [data-ui-profile="preview"] .board-column .world-heading-controls > .world-top,
  [data-ui-profile="preview"] .online #gameShell .world-heading-controls > .world-top { position: static; max-width: 100% !important; }
  [data-ui-profile="preview"] .board-column .world-top,
  [data-ui-profile="preview"] .online #gameShell .world-top { top: 18px; left: 12px; max-width: calc(100% - 190px) !important; }
  [data-ui-profile="preview"] .board-column .world-top h1,
  [data-ui-profile="preview"] .online #gameShell .world-top h1 { font-size: 22px; }
  [data-ui-profile="preview"] .world > .player-list { width: 164px; right: 8px; }
  [data-ui-profile="preview"] .world > .board-bank { width: 148px; inset-inline-start: 8px; bottom: 8px; padding: 8px; }
  [data-ui-profile="preview"] .board-bank .bank-stacks { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
  [data-ui-profile="preview"] .board-bank .bank-stack { height: 45px; }
  [data-ui-profile="preview"] .board-bank .bank-deck { margin-left: 0; }
  [data-ui-profile="preview"] .board-bank .bank-name { font-size: 7px; bottom: 3px; }
  [data-ui-profile="preview"] .board-bank .bank-count { font-size: 13px; }
  [data-ui-profile="preview"] .board-bank .bank-heading { margin-bottom: 6px !important; font-size: 10px !important; }
  [data-ui-profile="preview"] .board-bank .bank-notice { font-size: 10px; line-height: 1.25; margin-top: 6px; }
  [data-ui-profile="preview"] .board-dice { inset-inline-end: 8px; bottom: 10px; }
  [data-ui-profile="preview"] .board-dice .dice-pair { gap: 12px; padding: 8px; }
  [data-ui-profile="preview"] .board-dice .die { width: 42px; height: 42px; padding: 7px; gap: 3px; }
  [data-ui-profile="preview"] .board-dice .ready-to-roll .die { width: clamp(56px, 18cqw, 84px); height: clamp(56px, 18cqw, 84px); padding: clamp(9px, 3cqw, 14px); gap: 4px; }
  [data-ui-profile="preview"] .board-end-turn { right: 12px; bottom: 88px; min-width: 116px; margin: 0; }
  [data-ui-profile="preview"] .board-column .world-heading-controls > .view-controls { position: static; inset: auto; max-width: 100%; transform: none; justify-content: flex-start; pointer-events: auto; }
  [data-ui-profile="preview"] .board-column .view-controls button { min-height: 38px; font-size: 11px; padding: 8px; }
}

@container worldbound-board (max-width: 460px) {
  [data-ui-profile="preview"] .world-heading-controls { width: calc(100% - 168px); }
  [data-ui-profile="preview"] .world > .player-list { width: 138px; }
  [data-ui-profile="preview"] .player-list .player-name { font-size: 11px; }
  [data-ui-profile="preview"] .player-list .player-row { padding: 4px; gap: 3px; }
  [data-ui-profile="preview"] .board-column .world-top,
  [data-ui-profile="preview"] .online #gameShell .world-top { max-width: calc(100% - 168px) !important; }
  [data-ui-profile="preview"] .board-column .world-top h1,
  [data-ui-profile="preview"] .online #gameShell .world-top h1 { font-size: 20px; }
  [data-ui-profile="preview"] .board-column .world-top p { font-size: 11px; line-height: 1.45; }
}

@media (max-width: 900px) and (min-width: 761px) {
  [data-ui-profile="preview"] .creation-rules { grid-template-columns: 1fr 1fr; }
  [data-ui-profile="preview"] .creation-rules > :last-child { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  [data-ui-profile="preview"] #createDialog { padding: 18px; width: calc(100vw - 20px); max-height: calc(100svh - 20px); }
  [data-ui-profile="preview"] #createDialog[open] { gap: 16px; }
  [data-ui-profile="preview"] .creation-heading h2 { font-size: 25px; }
  [data-ui-profile="preview"] .creation-footer { bottom: -18px; padding: 12px 0 6px; }
  [data-ui-profile="preview"] #createDialog #create { min-width: 134px; }
  [data-ui-profile="preview"] .online #roomsDialog { padding: 22px 14px; max-height: calc(100svh - 20px); }
  [data-ui-profile="preview"] .browser-tools { gap: 12px; padding: 12px; }
  [data-ui-profile="preview"] .browser-tools label:first-child { grid-column: auto; }
  [data-ui-profile="preview"] .browser-detail dl { grid-template-columns: minmax(100px, 1fr) minmax(0, 1.4fr); }
  [data-ui-profile="preview"] .browser-detail { padding: 16px; }
  [data-ui-profile="preview"] .browser-table-wrap { max-height: 32svh; }
  [data-ui-profile="preview"] .online #lobbyScreen { padding: 24px 16px; }
  [data-ui-profile="preview"] .online #lobbyScreen #match { padding: 18px; }
  [data-ui-profile="preview"] .lobby-details { padding: 18px; }
  [data-ui-profile="preview"] .lobby-player { gap: 8px; }
  [data-ui-profile="preview"] .lobby-footer button { flex: 1; min-height: 44px; }
  [data-ui-profile="preview"] .invite-buttons { gap: 8px; }
}

@media (max-width: 720px) {
  [data-ui-profile="preview"] .board-column .world-heading-controls > .world-top,
  [data-ui-profile="preview"] .online #gameShell .world-heading-controls > .world-top { position: static; max-width: 100% !important; }
  [data-ui-profile="preview"] .board-column .world-heading-controls > .view-controls { position: static; inset: auto; transform: none; max-width: 100%; justify-content: flex-start; pointer-events: auto; }
  [data-ui-profile="preview"] .online #menuScreen { padding-bottom: 48px; gap: 20px; }
  [data-ui-profile="preview"] .online #landingScreen { padding: 16px 18px 32px; }
  [data-ui-profile="preview"] #landingScreen .landing-copy { min-height: 160px; }
  [data-ui-profile="preview"] #landingScreen h1 { font-size: clamp(48px, 13vw, 64px); letter-spacing: -.05em; }
  [data-ui-profile="preview"] .online #menu .lobby-card { padding: 22px; }
  [data-ui-profile="preview"] .public-card { padding: 22px; }
  [data-ui-profile="preview"] .options-panel { max-height: calc(100svh - 96px); }
  [data-ui-profile="preview"] .online #onlinePanel { padding: 12px; }
}

@media (max-width: 640px) {
  [data-ui-profile="preview"] .trade-dialog { padding: 22px 14px; }
  [data-ui-profile="preview"] .trade-columns { gap: 18px; }
  [data-ui-profile="preview"] .card-source { gap: 6px; }
  [data-ui-profile="preview"] .card-source .resource-card { min-height: 100px; font-size: 10px; }
  [data-ui-profile="preview"] .trade-footer { bottom: -22px; }
  [data-ui-profile="preview"] .action-card-dialog { padding: 24px 18px; }
  [data-ui-profile="preview"] .action-card-detail { gap: 16px; }
  [data-ui-profile="preview"] .action-card-detail > .action-card-art { width: 100px; height: 140px; }
  [data-ui-profile="preview"] .resource-picker { gap: 7px; }
  [data-ui-profile="preview"] .resource-picker-name { font-size: 9px; }
  [data-ui-profile="preview"] #economyDialog #economy { padding: 22px 18px; }
  [data-ui-profile="preview"] .economy-heading h2 { font-size: 25px; }
  [data-ui-profile="preview"] .subscription-grid { grid-template-columns: 1fr; }
}

@media (max-width: 380px) {
  [data-ui-profile="preview"] #emailLogin { grid-template-columns: 1fr; }
  [data-ui-profile="preview"] .action-card-detail { align-items: center; gap: 12px; }
  [data-ui-profile="preview"] .action-card-detail > .action-card-art { width: 86px; height: 120px; }
  [data-ui-profile="preview"] .action-card-detail p { font-size: 13px; }
  [data-ui-profile="preview"] .creation-identity { grid-template-columns: 1fr; }
  [data-ui-profile="preview"] .creation-identity > .creation-field { grid-column: 1 / -1; }
  [data-ui-profile="preview"] #createDialog #create,
  [data-ui-profile="preview"] #createDialog #cancelCreate { min-width: 0; flex: 1; padding-inline: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  [data-ui-profile="preview"] :is(button, .resource-picker-card, .action-card-thumb) { transition: none; }
  [data-ui-profile="preview"] :is(.resource-picker-card, .resource-card, .action-card-thumb):hover { transform: none; }
}

/* Phones keep the current turn visible without covering the globe with every seat. */
@media (max-width: 720px), (orientation:landscape) and (max-height:500px) and (hover:none) and (pointer:coarse) {
  :is(html[data-ui-profile="preview"], .phone-landscape) .world > .player-list { width: min(172px, 44vw); padding: 4px; max-height: none; overflow: visible; }
  :is(html[data-ui-profile="preview"], .phone-landscape) .player-list > .player-roster-toggle { display: grid; grid-template-columns: minmax(0, 1fr) 16px; align-items: center; gap: 3px 6px; width: 100%; min-height: 46px; padding: 6px 7px; border: 0; border-radius: 7px; background: transparent; color: inherit; text-align: start; box-shadow: none; }
  :is(html[data-ui-profile="preview"], .phone-landscape) .player-roster-toggle .roster-current { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 12px/1.3 system-ui; border-inline-start: 3px solid var(--player-color); padding-inline-start: 6px; }
  :is(html[data-ui-profile="preview"], .phone-landscape) .player-roster-toggle .roster-count { grid-column: 1; font: 11px/1.3 system-ui; opacity: .85; padding-inline-start: 9px; }
  :is(html[data-ui-profile="preview"], .phone-landscape) .player-roster-toggle .roster-chevron { grid-column: 2; grid-row: 1 / 3; font-size: 16px; }
  :is(html[data-ui-profile="preview"], .phone-landscape) .player-list > .player-roster { display: none; }
  :is(html[data-ui-profile="preview"], .phone-landscape) .player-list.roster-expanded > .player-roster { display: block; max-height: min(44svh, 310px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 3px; }
  :is(html[data-ui-profile="preview"], .phone-landscape) .player-roster > .players-heading { display: none; }
  :is(html[data-ui-profile="preview"], .phone-landscape) .player-list.roster-expanded { width: min(232px, calc(100vw - 24px)); z-index: 12; }
  :is(html[data-ui-profile="preview"], .phone-landscape) .player-roster .player-more > summary { min-width: 44px; min-height: 36px; }
  :is(html[data-ui-profile="preview"], .phone-landscape) .player-roster .player-options button { min-height: 44px; }
}

/* Compact phone match controls, shared by Original and Preview. */
@media(max-width:720px){
 html body:has(.board-column>.combined-hands:not([hidden]))>header{height:60px;min-height:60px;padding-block:6px}
 html[data-ui-profile] .board-column .world-heading-controls{display:contents}
 html[data-ui-profile] .board-column .world-heading-controls>.world-top,
 html[data-ui-profile] .online #gameShell .board-column .world-heading-controls>.world-top{position:absolute;top:12px;left:12px;max-width:calc(100% - 190px)!important;pointer-events:none}
 html[data-ui-profile] .board-column .world-heading-controls>.view-controls{position:absolute!important;inset:78px 8px auto auto!important;width: min(172px,44vw);max-width:none!important;transform:none!important;display:flex;flex-direction:column;align-items:stretch;gap:5px;pointer-events:auto}
 html[data-ui-profile] .board-column .world-heading-controls>.view-controls button{min-height:36px;padding:6px;font-size:11px}
 html .world:has(.player-list.roster-expanded) .view-controls{visibility:hidden}
 html[data-ui-profile] .combined-hands .hand-card{height:96px!important}
 html[data-ui-profile] .combined-hands .hand-trade{align-self:flex-start!important;margin-top:2px;min-height:44px}
}

/* Phone shortcut scrolls to the always-visible action-card panel. */
.hand-actions{display:contents}.hand-actions-toggle{display:none}
@media(max-width:720px){
 html[data-ui-profile] .combined-hands .hand-actions{display:flex;flex:0 0 65px;flex-direction:column;gap:6px;align-self:stretch;justify-content:space-between}
 html[data-ui-profile] .combined-hands .hand-actions>button{display:block;flex:none;width:100%;min-height:44px;margin:0;padding:5px;font-size:11px;white-space:normal}
 html[data-ui-profile] .board-column .world-heading-controls>.view-controls{flex-direction:row;justify-content:flex-end;gap:6px}
 html[data-ui-profile] .board-column .world-heading-controls>.view-controls :is(#home,.world-transparency){width:44px;min-width:44px;height:44px;min-height:44px;padding:9px;font-size:0}
 html[data-ui-profile] .view-controls :is(#home,.world-transparency)::before{content:'';display:block;width:24px;height:24px;background-position:center;background-size:contain;background-repeat:no-repeat}
 html[data-ui-profile] .view-controls #home::before{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f5db9d' stroke-width='1.7' stroke-linejoin='round'%3E%3Cpath d='M2 11 12 3l10 8M5 9v12h14V9M9 21v-7h6v7'/%3E%3C/svg%3E")}
 html[data-ui-profile] .view-controls .world-transparency::before{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f5db9d' stroke-width='1.7'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cellipse cx='12' cy='12' rx='4' ry='9' stroke-dasharray='2 2'/%3E%3Cpath d='M3 12h18M5 6h14M5 18h14' stroke-dasharray='2 2'/%3E%3C/svg%3E")}
 html[data-ui-profile] .world-top .turn-clock{display:inline-block;padding:4px 8px;margin:4px 0;font-size:14px}
 html[data-ui-profile] .world-top .turn-clock[hidden]{display:none}
}

.action-card-host.action-panel-cue{position:relative;outline:2px solid #f5db9d;outline-offset:-2px;box-shadow:inset 0 0 14px #f5db9d55;animation:action-panel-cue 1s ease-out}
@keyframes action-panel-cue{0%,25%{outline-color:#fff0bb;box-shadow:inset 0 0 18px #f5db9d88}100%{outline-color:transparent;box-shadow:inset 0 0 0 transparent}}
@media(prefers-reduced-motion:reduce){.action-card-host.action-panel-cue{animation:none}}

/* Desktop match sidebar can give its space to the board. Card sizes and the
   expanded sidebar retain their existing layout in both interface profiles. */
@media(min-width:721px){
 html body:has(>.match-layout.match-active)>header{height:68px;min-height:68px}
 html .match-layout.match-active>.board-column{height:calc(100svh - 68px)}
 html .match-layout.match-active>.match-sidebar,
 html body.online #gameShell.match-layout.match-active>#onlinePanel{max-height:calc(100svh - 68px)}
 html body .match-layout.match-active,
 html body.online #gameShell.match-layout.match-active{min-height:calc(100svh - 68px)}
 /* Ad docks retain their columns and collapse only --dock-sidebar. */
 html body .match-layout.match-active.sidebar-collapsed:not([data-ad-dock=on]),
 html body.online #gameShell.match-layout.match-active.sidebar-collapsed:not([data-ad-dock=on]){grid-template-columns:minmax(0,1fr)}
 html .match-layout>.match-sidebar[hidden]{display:none}
 html header .match-sidebar-toggle{display:inline-flex;align-items:center;justify-content:center;gap:7px;height:45px;min-height:45px;padding:9px 12px;font-size:13px;border-color:#51616a;background:#172b36}
 html header .match-sidebar-toggle[hidden]{display:none}
 html header .match-sidebar-toggle[aria-expanded="true"]{color:#f4d494}
 html header .match-sidebar-icon{font-size:20px;line-height:1}
}

/* Larger dice use the existing dock; End turn remains independently positioned. */
@media(min-width:1001px){html .board-dice .die{width:66px;height:66px;padding:11px}html .board-dice .ready-to-roll .die{width:124px;height:124px;padding:20px}}
@media(min-width:721px) and (max-width:1000px){html .board-dice .die{width:57px;height:57px;padding:10px}html .board-dice .ready-to-roll .die{width:103px;height:103px;padding:17px}}
@media(max-width:720px){
 html[data-ui-profile] .board-dice .die{width:49px;height:49px;padding:8px;gap:3px}
 html[data-ui-profile] .board-dice .ready-to-roll .die{width:clamp(68px,20vw,90px);height:clamp(68px,20vw,90px);padding:12px;gap:4px}
}

/* Short landscape matches use the full width. Leave space beside the globe
   for scrolling the page while globe drags and pinches stay on its canvas. */
html body:has(>.match-layout.phone-landscape)>header{height:auto;min-height:52px;padding:4px 12px;gap:8px}
html :is(main.match-layout,#gameShell).phone-landscape{display:flex;flex-direction:column;min-height:0}
html :is(main.match-layout,#gameShell).phone-landscape>.match-sidebar{
 width:100%;min-height:0;max-height:none;overflow:visible;border-inline-start:0;border-top:1px solid var(--line);padding:12px;
}
html :is(main.match-layout,#gameShell).phone-landscape>.board-column{width:100%;height:auto;min-height:0}
html :is(main.match-layout,#gameShell).phone-landscape>.board-column>.world{
 --landscape-board-height:clamp(260px,calc(100svh - 52px),450px);
 --landscape-control-bottom:max(8px,calc(100% - var(--landscape-board-height) + 8px));
 flex:none;height:var(--landscape-board-height);min-height:0;max-height:none;
}
html :is(main.match-layout,#gameShell).phone-landscape #viewport{inset-inline:clamp(112px,19vw,180px)}
.phone-landscape .board-column .world-heading-controls{display:contents}
html :is(main.match-layout,#gameShell).phone-landscape .board-column .world-heading-controls>.world-top{
 position:absolute;top:6px;left:12px;max-width:min(38%,300px)!important;pointer-events:none;
}
html :is(main.match-layout,#gameShell).phone-landscape .world-top h1{font-size:20px;margin:0 0 2px}
html .phone-landscape .board-column .world-top p{font-size:11px;margin-block:2px;line-height:1.35}
.phone-landscape .piece-supply{margin-top:4px}
.phone-landscape .piece-supply-heading{display:none}

html .phone-landscape .world>.board-bank{inset-inline-start:62px;bottom:0;width:clamp(198px,28vw,240px);padding:5px;border-radius:8px 8px 0 0}
html .phone-landscape .board-bank .bank-stacks{grid-template-columns:repeat(6,minmax(0,1fr));gap:3px}
html .phone-landscape .board-bank .bank-stack{height:38px;margin-inline-start:0}
html .phone-landscape .board-bank .bank-count{font-size:12px}
html .phone-landscape .board-bank .bank-name{font-size:7px}
html .phone-landscape .board-bank .bank-heading{margin-bottom:4px!important}
html .phone-landscape .world>.player-list{top:8px;inset-inline-end:8px;width:144px}
html .phone-landscape .world>.player-list.roster-expanded{width:min(210px,36vw)}
html .phone-landscape .player-list.roster-expanded>.player-roster{max-height:min(86px,20svh)}
html .phone-landscape .board-dice{bottom:var(--landscape-control-bottom);inset-inline-end:8px}
html .phone-landscape .board-dice .dice-pair{gap:10px;padding:5px}
html .phone-landscape .board-dice .die{width:40px;height:40px;padding:6px;gap:3px}
html .phone-landscape .board-dice .ready-to-roll .die{width:62px;height:62px;padding:10px;gap:4px}
html .phone-landscape .world .board-end-turn{right:8px;bottom:calc(var(--landscape-control-bottom) + 58px);min-height:44px;margin:0}
html .phone-landscape .world:has(.roster-expanded) .board-end-turn{right:120px;bottom:var(--landscape-control-bottom)}
.phone-landscape .combined-hands .board-hand{flex-basis:340px;padding:8px}
.phone-landscape .combined-hands .action-card-host{flex-basis:280px}
html .phone-landscape .combined-hands :is(.hand-card,.action-card-thumb){height:96px}
.phone-landscape .combined-hands .action-card-thumb{flex-basis:68px;width:68px}
.phone-landscape .combined-hands .action-card-buy{min-height:52px}
