/* The remote entry and table reuse the shared paper, ink, card art and shell. */
.remote-lobby { max-width: 1100px; margin: 8px auto; padding: clamp(16px, 2vw, 28px); text-align: center; }
body[data-remote-role][data-screen="menu"] .brand { display: none; }
body[data-remote-role][data-screen="menu"] #main-menu { max-width: 1100px; width: 100%; }
.remote-heading { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 20px; }
.remote-lobby-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.remote-lobby-status { flex: 1 0 100%; margin: 8px 0; }
.remote-heading h2 { font: 400 clamp(26px, 5vw, 46px)/1.1 var(--font-ui); margin: 0; text-align: left; }
@media (max-width: 560px) {
  .remote-heading { gap: 8px; }
  .remote-heading .brand-mark { width: 54px; height: 54px; }
}
.remote-access { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.remote-access p { margin: 4px; }
.remote-access a { overflow-wrap: anywhere; color: var(--pop-ink); }
.remote-qr { width: min(24vh, 200px); height: auto; border: 3px solid var(--pop-ink); border-radius: 8px; }
.remote-code { font-size: 22px; }
.remote-join { display: grid; grid-template-columns: 1fr; gap: 10px; max-width: 380px; margin: 20px auto; text-align: left; }
.remote-join input { width: 100%; min-height: 46px; padding: 8px 12px; font: 20px var(--font-ui); border: 2px solid var(--pop-ink); border-radius: 8px; }
.remote-seats { list-style: none; display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; padding: 0; margin: 22px 0; }
.remote-seats li { min-width: 130px; display: grid; gap: 6px; padding: 10px 18px; border-bottom: 3px dashed var(--pop-ink); }
.remote-seats .connected { border-bottom-style: solid; }
.remote-lifetime { font-size: 14px; margin-top: 20px; }
.remote-setup { margin: 18px auto; }
.remote-configuration-summary { font-size: 22px; margin: 12px 0; }
.remote-configuration { display: flex; flex-wrap: wrap; align-items: end; justify-content: center; gap: 16px; }
.remote-configuration label { display: grid; gap: 6px; text-align: left; }
.remote-configuration select { min-height: 44px; min-width: 100px; padding: 5px 12px; font: 22px var(--font-ui); border: 2px solid var(--pop-ink); border-radius: 6px; background: var(--pop-paper); color: var(--pop-ink); }
.remote-catalog { margin-top: 24px; }
.remote-catalog .game-boxes { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.remote-catalog .game-box { min-height: 200px; padding: 18px 12px 28px; grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; text-align: center; }
.remote-catalog .box-name { font-size: 28px; }
.remote-catalog .box-art { grid-column: 1; grid-row: 2; height: 85px; }
.remote-catalog .box-art .card-art { width: 46px; left: calc(50% - 23px); }
.remote-catalog .box-action { font-size: 18px; }
.remote-catalog .box-session { left: 4px; right: 4px; font-size: 12px; }
.remote-catalog .game-box.incompatible { filter: grayscale(1); --box-color: #d1cfc9; }
.remote-catalog .game-box[aria-pressed="true"] { outline: 4px solid var(--pop-ink); outline-offset: 4px; }
.remote-choice-message { max-width: 580px; margin: 18px auto 0; font-size: 19px; }
.remote-choice-message:empty { display: none; }
@media (max-width: 560px) {
  .remote-lobby { padding: 16px 12px; }
  .remote-catalog .game-boxes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .remote-catalog .box-name { font-size: 24px; }
}
.remote-strip { display: flex; gap: 8px; align-items: center; min-width: 0; font-size: 14px; }
.remote-identity { max-width: 230px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
.remote-connection { max-width: 320px; }
body[data-remote-role] .local-badge { display: none; }
body[data-remote-role][data-screen="game"] .topbar { flex-wrap: wrap; }
body[data-remote-role][data-screen="game"] .remote-strip { flex: 1 0 100%; justify-content: center; min-height: 22px; }
body[data-remote-role][data-screen="game"] .remote-strip .button { min-height: 32px; padding: 3px 10px; font-size: 14px; }
/* Healthy connection/role prose does not need another row above the TV felt.
   Recovery, pause and room controls remain in the existing header. */
body[data-remote-role="display"][data-screen="game"] .topbar { flex-wrap: nowrap; }
body[data-remote-role="display"][data-screen="game"] .top-actions { margin-left: auto; }
body[data-remote-role="display"][data-screen="game"] .remote-strip { flex: 0 1 auto; min-height: 0; }
body[data-remote-role="display"][data-screen="game"] .remote-identity,
body[data-remote-role="display"][data-screen="game"] .remote-strip[data-attention="false"] .remote-connection {
  position: absolute; width: 1px; height: 1px; min-height: 0; overflow: hidden; clip-path: inset(50%);
}
body[data-remote-role] .game-cinquillo .opponents { justify-content: center; }
body[data-remote-role="display"] .controller, body[data-remote-role="display"] .control-strip,
body[data-remote-role="display"] #inspect-cards { display: none !important; }
body[data-remote-role="display"] #game-table { height: 100%; }
body[data-remote-role="display"] .game-cinquillo .card-slots { --sequence-card: min(160px, calc((100cqh - 32px) * 110 / 624)); }
body[data-remote-role="controller"][data-remote-surface="hand"] #game-table { display: none; }
body[data-remote-role="controller"][data-remote-surface="hand"] .table-scene { grid-template-rows: 26px minmax(0, 1fr); }
body[data-remote-role="controller"][data-remote-surface="hand"] .controller { align-self: center; width: 100%; }
body[data-remote-role="controller"][data-remote-surface="hand"] .table-game { --hand-card: clamp(96px, 35dvh, 210px); }
body[data-remote-role="controller"][data-remote-surface="table"] .table-game { --hand-card: 62px; }
body[data-remote-role="controller"][data-remote-surface="table"] .hand { height: 98px; }
body[data-remote-role="controller"][data-remote-surface="table"]:not([data-remote-group-selection="true"]) .hand-card { --fan-x: 0px !important; --fan-y: 0px !important; --fan-angle: 0deg !important; }
body[data-remote-role="controller"][data-remote-surface="table"][data-remote-selected="false"] .controller { display: none; }
body[data-remote-role="controller"] .game-cinquillo .foundation { grid-template-columns: 22px minmax(0,1fr); }
body[data-remote-role="controller"] .game-cinquillo .card-slots { --sequence-card: min(80px, calc((100cqh - 20px) * 110 / 624)); }
body[data-remote-role] .game-cinquillo .card-slot { min-height: 0; }
@media (max-height: 450px) and (orientation: landscape) {
  body[data-remote-role][data-screen="game"] .brand h1 { font-size: 18px; }
  body[data-remote-role][data-screen="game"] .topbar { gap: 2px 8px; }
  body[data-remote-role][data-screen="game"] .remote-strip { min-height: 18px; font-size: 12px; }
  body[data-remote-role="controller"][data-remote-surface="hand"] .opponent-detail strong { font-size: 12px !important; }
  body[data-remote-role="controller"] .game .opponents { min-height: 22px; }
  body[data-remote-role="controller"][data-remote-surface="hand"] .table-scene { padding: 0 6px !important; }
}
@media (max-width: 550px) and (orientation: portrait) {
  .remote-strip { flex-wrap: wrap; }
  body[data-remote-role="controller"] .brand { display: none; }
  body[data-remote-role="controller"] .top-actions { width: 100%; justify-content: space-between; }
}
body[data-remote-role="controller"] .controller { justify-self: center; margin-inline: auto; }
body[data-remote-role="controller"][data-screen="game"] .table-game .table-scene { grid-template-columns: minmax(0, 1fr); grid-template-rows: 26px minmax(0, 1fr) auto; }
body[data-remote-role="controller"][data-screen="game"][data-remote-surface="hand"] .table-game .table-scene { grid-template-rows: 26px minmax(0, 1fr); }
body[data-remote-role="controller"][data-screen="game"] .table-game .controller { grid-column: 1; width: 100%; align-self: end; }
body[data-remote-role="controller"][data-screen="game"][data-remote-surface="hand"] .table-game .controller { align-self: center; }
body[data-remote-role="controller"] .card-slot::after { content: ''; position: absolute; inset: 0; min-width: 44px; min-height: 44px; }
body[data-remote-role="controller"][data-remote-surface="table"]:not([data-remote-group-selection="true"]) .hand .hand-card:is(:hover,:focus-visible,.selected) { transform: translate(0, -20px) rotate(0deg) !important; }
body[data-remote-role] .table-game .opponents .opponent { flex: 0 0 auto; }
/* The radial No val table uses the same available surface in both audiences. */
body[data-remote-role] .game-tableau .opponents { justify-content: center; }
body[data-remote-role="display"][data-screen="game"] .game-tableau .tableau-table { width: min(100%, 1300px); }
body[data-remote-role="display"][data-screen="game"] .game-tableau .table-scene { grid-template-columns: minmax(0, 1fr); }
body[data-remote-role="controller"][data-remote-surface="table"] .game-tableau .controller { pointer-events: none; }
body[data-remote-role="controller"][data-remote-surface="table"] .game-tableau .hand-card { pointer-events: auto; }

/* Portraits are the lobby's player identity, shared with the in-game renderer. */
.remote-seats .remote-seat { min-width: 0; width: 130px; padding: 6px; justify-items: center; align-content: start; }
.remote-seat-avatar { display: grid; place-items: center; position: relative; width: 100px; height: 108px; font: 52px var(--font-ui); background: var(--pop-paper); border: 2px solid var(--pop-ink); border-radius: 16px; }
.remote-seat-avatar > * { width: 100%; height: 100%; }
.remote-seat strong { max-width: 100%; overflow-wrap: anywhere; font-size: 20px; line-height: 1.1; }
.remote-seat-status { font-size: 13px; line-height: 1.2; }
.remote-cpu-dialog { width: min(460px, calc(100vw - 24px)); padding: 24px; color: var(--pop-ink); }
.remote-cpu-dialog h2 { margin-bottom: 18px; font: 32px var(--font-ui); }
.remote-cpu-dialog .remote-configuration { display: grid; }
.remote-cpu-dialog select { width: 100%; min-width: 0; font-size: 20px; }

/* A TV is one screen: roster above, invitation beside, all compatible games below. */
@media (min-width: 760px) {
  body[data-remote-role="display"][data-screen="menu"] .app-shell { max-width: none; height: 100dvh; padding: 10px 18px; display: flex; flex-direction: column; }
  body[data-remote-role="display"][data-screen="menu"] .topbar { flex: 0 0 auto; margin: 0 0 4px; padding: 0; min-height: 22px; }
  body[data-remote-role="display"][data-screen="menu"] #main-menu { max-width: none; flex: 1; min-height: 0; margin: 0; }
  body[data-remote-role="display"] .remote-lobby { height: 100%; max-width: none; margin: 0; padding: 12px 18px; display: grid; grid-template-columns: clamp(160px, 17vw, 240px) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; gap: 10px 22px; }
  body[data-remote-role="display"] .remote-heading { grid-column: 1; grid-row: 1; gap: 7px; margin: 0; }
  body[data-remote-role="display"] .remote-heading .brand-mark { width: 54px; height: 54px; }
  body[data-remote-role="display"] .remote-heading h2 { font-size: 25px; }
  body[data-remote-role="display"] .remote-access { grid-column: 1; grid-row: 2; align-self: center; font-size: 15px; }
  body[data-remote-role="display"] .remote-qr { width: min(17vw, 24dvh, 210px); }
  body[data-remote-role="display"] .remote-seats { grid-column: 2; grid-row: 1; display: grid; grid-template-columns: repeat(var(--roster-count), minmax(0, 1fr)); gap: 7px; margin: 0; }
  body[data-remote-role="display"] .remote-seats .remote-seat { width: 100%; gap: 4px; padding: 2px 0 6px; }
  body[data-remote-role="display"] .remote-seat-avatar { width: min(100%, 13dvh, 110px); height: auto; aspect-ratio: 1 / 1.08; }
  body[data-remote-role="display"] .remote-seat strong { font-size: clamp(16px, 1.4vw, 24px); }
  body[data-remote-role="display"] .remote-setup { grid-column: 2; grid-row: 2; min-height: 0; width: 100%; margin: 0; display: flex; flex-direction: column; gap: 6px; }
  body[data-remote-role="display"] .remote-configuration-summary { font-size: 16px; margin: 0; }
  body[data-remote-role="display"] .remote-catalog { flex: 1; min-height: 0; margin: 0; display: flex; flex-direction: column; }
  body[data-remote-role="display"] .menu-intro { margin: 0 0 6px; }
  body[data-remote-role="display"] .menu-intro h2 { font-size: 25px; }
  body[data-remote-role="display"] .menu-intro p { margin: 0; }
  body[data-remote-role="display"] .remote-catalog .game-boxes { flex: 1; min-height: 0; max-height: calc(var(--catalog-rows) * 190px + 3px); grid-template-columns: repeat(var(--catalog-columns), minmax(0, 1fr)); grid-template-rows: repeat(var(--catalog-rows), minmax(0, 1fr)); gap: 10px 12px; padding: 4px 7px 9px; }
  body[data-remote-role="display"] .remote-catalog .game-box { min-height: 0; min-width: 0; padding: 9px 9px 6px; grid-template-columns: minmax(0, 1fr) 54px; grid-template-rows: 1fr auto; gap: 2px 5px; text-align: left; transform: none; box-shadow: 3px 4px 0 var(--pop-ink); }
  body[data-remote-role="display"] .remote-catalog .game-box::before { height: 5px; }
  body[data-remote-role="display"] .remote-catalog .box-name { font-size: clamp(18px, 1.65vw, 30px); }
  body[data-remote-role="display"] .remote-catalog .box-art { grid-column: 2; grid-row: 1 / 3; height: 58px; }
  body[data-remote-role="display"] .remote-catalog .box-art .card-art { width: 30px; left: calc(50% - 15px); top: 8px; }
  body[data-remote-role="display"] .remote-catalog .box-art .card-art:nth-child(1) { transform: translateX(-10px) rotate(-19deg); }
  body[data-remote-role="display"] .remote-catalog .box-art .card-art:nth-child(3) { transform: translateX(10px) rotate(17deg); }
  body[data-remote-role="display"] .remote-catalog .box-action { display: none; }
  body[data-remote-role="display"] .remote-catalog .box-session { position: static; grid-column: 1; font-size: 11px; }
  body[data-remote-role="display"] .remote-catalog .game-box[aria-pressed="true"] .box-name { text-decoration: underline; text-underline-offset: 4px; }
  body[data-remote-role="display"] .remote-choice-message { margin: 0; font-size: 15px; }
  body[data-remote-role="display"] .remote-lobby-actions { grid-column: 2; grid-row: 3; }
  body[data-remote-role="display"] .remote-lobby-status { margin: 0; font-size: 14px; }
  body[data-remote-role="display"] .remote-lifetime { grid-column: 1; grid-row: 3; margin: 0; font-size: 11px; }
}
@media (min-width: 1600px) {
  body[data-remote-role="display"] .remote-catalog .game-boxes { max-height: calc(var(--catalog-wide-rows) * 196px - 3px); grid-template-columns: repeat(var(--catalog-wide-columns), minmax(0, 1fr)); grid-template-rows: repeat(var(--catalog-wide-rows), minmax(0, 1fr)); gap: 16px; }
  body[data-remote-role="display"] .remote-catalog .game-box { grid-template-columns: minmax(0, 1fr) 80px; padding: 16px 12px 10px; }
  body[data-remote-role="display"] .remote-catalog .box-art { height: 88px; }
  body[data-remote-role="display"] .remote-catalog .box-art .card-art { width: 46px; left: calc(50% - 23px); }
  body[data-remote-role="display"] .remote-seat-avatar { width: min(100%, 144px); }
}
@media (min-width: 760px) and (max-height: 600px) {
  body[data-remote-role="display"] .remote-lobby { padding: 6px 10px; gap: 5px 14px; }
  body[data-remote-role="display"] .remote-seat-avatar { width: min(100%, 52px); }
  body[data-remote-role="display"] .remote-seat-status { font-size: 10px; }
  body[data-remote-role="display"] .remote-seat strong { font-size: 14px; }
  body[data-remote-role="display"] .remote-catalog .game-box { grid-template-columns: minmax(0, 1fr); grid-template-rows: 1fr; padding: 4px 5px 3px; }
  body[data-remote-role="display"] .remote-catalog .game-box::before { display: none; }
  body[data-remote-role="display"] .remote-catalog .box-art,
  body[data-remote-role="display"] .remote-catalog .box-action,
  body[data-remote-role="display"] .remote-catalog .box-session { display: none; }
  body[data-remote-role="display"] .remote-catalog .game-box[aria-pressed="true"] { outline-offset: 1px; outline-width: 3px; }
  body[data-remote-role="display"] .remote-catalog .box-name { font-size: 16px; }
  body[data-remote-role="display"] .menu-intro h2 { font-size: 18px; }
  body[data-remote-role="display"] .menu-intro p { display: none; }
  body[data-remote-role="display"] .remote-configuration-summary { display: none; }
  body[data-remote-role="display"] .remote-lifetime { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  body[data-remote-role="display"] .remote-access { font-size: 12px; }
  body[data-remote-role="display"] .remote-access p:not(.remote-code) { display: none; }
}
