/* Acabados compartidos por la vista del club y la mesa abierta. */
.mesa-cartas {
  --mesa-luz: #773f49;
  --mesa-sombra: #382129;
  --mesa-filete: #d4a16d;
  --mesa-banda: linear-gradient(160deg, #704d43, #39282a 22%, #21191a 48%, #493236 78%, #754f42);
  --mesa-pano:
    repeating-linear-gradient(38deg, #f3ebd908 0 .6px, transparent .6px 3px),
    radial-gradient(ellipse at 45% 32%, var(--mesa-luz), var(--mesa-sombra) 92%);
  --mesa-suelo: radial-gradient(ellipse at 50% 38%, #342628, #1f1819 66%, #150d0e);
  --mesa-leyenda: #e7d4c3;
}
.mesa-cartas[data-variant="trio-par"] {
  --mesa-luz: #5a4740;
  --mesa-sombra: #2a2223;
}
.mesa-cartas[data-variant="tres-tres"] {
  --mesa-luz: #65495b;
  --mesa-sombra: #322532;
}
.mesa-cartas[data-variant="baccarat"] {
  --mesa-luz: #38604f;
  --mesa-sombra: #1d332c;
}
[data-home-theme="light"] .mesa-cartas {
  --mesa-suelo: radial-gradient(ellipse at 50% 46%, #c9bab6, #e6d8d1 68%, #f3e6e2);
  --mesa-leyenda: #4b3836;
}

/* La mesa proyecta una sola sombra. Su contorno real sirve también para orientar los sillones. */
html body :is(#club-view, .diseno-escenario) .public-table-preview.mesa-cartas,
html body[data-view="table"] #table-view #table-stage.mesa-cartas,
html body .bacc-shared .bacc-scene.mesa-cartas {
  background: var(--mesa-suelo);
}
html body :is(#club-view, .diseno-escenario) .public-table-preview.mesa-cartas {
  width: 100%;
  min-height: 246px;
  border: 1px solid var(--trio-edge, var(--line));
  border-radius: 14px;
}
.diseno-escenario > .public-table-preview.mesa-cartas {
  max-width: 640px;
  height: clamp(246px, 52vw, 330px);
}

html body :is(#club-view, .diseno-escenario) .mesa-cartas .public-preview-felt,
html body[data-view="table"] #table-view #table-stage.mesa-cartas .felt,
html body .bacc-shared .mesa-cartas > .bacc-felt.felt {
  border: 1px solid #9e7557;
  background: var(--mesa-banda);
  box-shadow: inset 0 1px 0 #ebc6a78a, inset 0 -3px 2px #150d0eae, 0 4px 0 #21191a, 0 8px 12px #150d0e75;
}
.mesa-cartas .public-preview-felt {
  inset: 18% 7% 16%;
  border-radius: 35% / 50%;
}
html body[data-view="table"] #table-view #table-stage.mesa-cartas .felt::before,
html body[data-view="table"] #table-view #table-stage.mesa-cartas .felt::after,
.mesa-cartas .public-preview-felt::before {
  content: none;
}

html body :is(#club-view, .diseno-escenario) .mesa-cartas .public-preview-felt-inner,
html body[data-view="table"] #table-view #table-stage.mesa-cartas .felt-inner,
html body .bacc-shared .mesa-cartas > .bacc-felt.felt > .felt-inner {
  position: absolute;
  inset: var(--mesa-canto, 9px);
  border-radius: inherit;
  border: 1px solid #d4a16d9c;
  background: var(--mesa-pano);
  box-shadow: inset 0 2px 6px #150d0e80;
  pointer-events: none;
}
#table-stage.mesa-cartas { --mesa-canto: clamp(10px, 1.35vw, 19px); }
#table-stage.mesa-cartas[data-native-card-portrait] { --mesa-canto: var(--apk-felt-edge); }
#table-stage.mesa-cartas[data-native-card-landscape] { --mesa-canto: var(--native-felt-edge); }
.mesa-cartas :is(.public-preview-felt-inner, .felt-inner)::before {
  content: '';
  position: absolute;
  inset: 5px;
  border: 1px solid #d4a16d45;
  border-radius: inherit;
}
html body[data-view="table"] #table-view #table-stage.mesa-cartas .felt-inner::after,
.mesa-cartas .public-preview-felt-inner::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--mesa-grabado) center / 62% 72% no-repeat;
  opacity: .95;
  pointer-events: none;
}
.mesa-cartas[data-has-hand="true"] .public-preview-felt-inner::after {
  opacity: .13;
}
html body[data-view="table"] #table-view #table-stage.mesa-cartas[data-has-hand="true"] .felt-inner::after {
  background-size: 38% 27%;
  background-position: 50% 22%;
  opacity: .32;
}
html body[data-view="table"] #table-view #table-stage.mesa-cartas[data-native-card-landscape][data-has-hand="true"] .felt-inner::after {
  background-size: 34% 54%;
  background-position: 84% 50%;
}
html body[data-view="table"] #table-view #table-stage.mesa-cartas .table-watermark {
  left: 0;
  top: 67%;
  width: 100%;
  transform: none;
  text-align: center;
}
html body[data-view="table"] #table-view #table-stage.mesa-cartas .table-watermark span {
  color: #e1c7ae;
}
#table-stage.mesa-cartas[data-has-hand="true"] .table-watermark { visibility: hidden; }

/* Cada control se ancla por su centro. La zona pulsable incluye la placa y el respaldo. */
html body :is(#club-view, .diseno-escenario) .mesa-cartas .public-preview-seat {
  left: var(--plaza-x, 50%);
  top: var(--plaza-y);
  width: clamp(60px, 18%, 86px);
  height: 44px;
  transform: translate(-50%, -50%);
}
.mesa-cartas .public-preview-seat[data-position="0"] { --plaza-y: 85%; }
.mesa-cartas .public-preview-seat[data-position="3"] { --plaza-y: 19%; }
.mesa-cartas .public-preview-seat:is([data-position="1"], [data-position="2"]) { --plaza-x: 85%; }
.mesa-cartas .public-preview-seat:is([data-position="4"], [data-position="5"]) { --plaza-x: 15%; }
.mesa-cartas .public-preview-seat:is([data-position="2"], [data-position="4"]) { --plaza-y: 34%; }
.mesa-cartas .public-preview-seat:is([data-position="1"], [data-position="5"]) { --plaza-y: 69%; }

html body :is(#club-view, .diseno-escenario) .mesa-cartas .public-preview-seat > .public-preview-sit {
  display: grid;
  place-items: center;
  isolation: isolate;
  position: relative;
  width: 100%;
  min-width: 0;
  height: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #fff6ea;
  font: 600 11px/1.2 Inter, 'Segoe UI', system-ui, sans-serif;
  white-space: nowrap;
  text-shadow: none;
  box-shadow: none;
  --foco-control: #d4926a;
}
html body :is(#club-view, .diseno-escenario) .mesa-cartas .public-preview-seat > .public-preview-sit::before {
  content: '';
  display: block;
  position: absolute;
  inset: 11px 1px;
  z-index: -1;
  margin: 0;
  border: 1px solid #b08568;
  border-radius: 999px;
  background: #2a2122;
  box-shadow: 0 2px 3px #150d0e55;
}
html body :is(#club-view, .diseno-escenario) .mesa-cartas .public-preview-seat > .public-preview-sit::after { content: none; }
html body :is(#club-view, .diseno-escenario) .mesa-cartas .public-preview-sit:is(:hover, :focus-visible):enabled::before {
  background: #513332;
  border-color: var(--mesa-filete);
}
html body :is(#club-view, .diseno-escenario) .mesa-cartas .public-preview-sit:disabled {
  color: #e3cdc1;
  opacity: 1;
}
.mesa-cartas .public-preview-seat > [hidden] { display: none !important; }

html body :is(#club-view, .diseno-escenario) .mesa-cartas .public-preview-plate {
  inset: auto 0 0;
  height: 31px;
  padding: 2px 4px;
  background: linear-gradient(#38292c, #21191a);
  border-color: #b58d74;
  border-radius: 6px;
  color: #fff6ea;
}
html body :is(#club-view, .diseno-escenario) .mesa-cartas .is-turn .public-preview-plate {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold);
}
.mesa-cartas .public-preview-chips { font-size: 12px; line-height: 12px; color: var(--gold); }
html body :is(#club-view, .diseno-escenario) .mesa-cartas .public-preview-avatar {
  top: -5px;
  left: calc(50% - 12px);
  width: 24px;
  height: 24px;
  background: #503238;
  border-color: #cb9d78;
  color: #fff6ea;
}
html body :is(#club-view, .diseno-escenario) .mesa-cartas .public-preview-backs {
  top: -12px;
  left: 15px;
  right: -2px;
}
.mesa-cartas .public-preview-name { line-height: 13px; }
.mesa-cartas .public-preview-board .filled > .android-card-face {
  display: block;
  width: 100%;
  height: 100%;
}
.mesa-cartas .public-preview-board .filled:has(> .android-card-face) > :is(.card-rank-main, .card-suit, .court-art) {
  display: none;
}
.mesa-cartas .public-preview-board > .filled { padding: 0; }
html body :is(#club-view, .diseno-escenario) .mesa-cartas .public-preview-seat.has-player:has(.public-preview-backs:not([hidden])) .public-preview-avatar { left: 0; }
html body :is(#club-view, .diseno-escenario) .mesa-cartas .public-preview-center { top: 50%; transform: translate(-50%, -50%); }
.mesa-cartas :is(.public-preview-bet, .public-preview-pot) { background: #21191a; color: #efd4a0; }
.mesa-cartas :is(.public-preview-caption, .public-preview-clock) { color: var(--mesa-leyenda); }
.mesa-cartas .public-preview-caption { left: 10px; top: 5px; max-width: 62%; }
.mesa-cartas .public-preview-clock { right: 10px; top: 5px; }

/* En móvil vertical el botón ya tiene el giro correcto. En horizontal lo aporta la capa del suelo. */
html body[data-view="table"] #table-view #table-stage.mesa-cartas[data-native-card-portrait] #seats .seat.open-seat .sit-button::before {
  background: var(--mesa-sillon) center / contain no-repeat;
  box-shadow: none;
}
html body[data-view="table"] #table-view #table-stage.mesa-cartas[data-native-card-landscape] .seat-furniture-r54 {
  background: var(--mesa-sillon) center / contain no-repeat;
}
html body[data-view="table"] #table-view #table-stage.mesa-cartas[data-native-card-landscape] .seat-furniture-r54::before,
html body[data-view="table"] #table-view #table-stage.mesa-cartas[data-native-card-landscape] .seat-furniture-r54::after {
  content: none;
}

/* En horizontal el motor ya sitúa el sillón por su esquina. Evitar una segunda traslación
   mantiene alineados el respaldo, la etiqueta y la zona que se puede pulsar. */
html body[data-view="table"] #table-view #table-stage.mesa-cartas[data-native-card-landscape] .seat-furniture-underlay-r58 {
  z-index: 2;
}
html body[data-view="table"] #table-view #table-stage.mesa-cartas[data-native-card-landscape] .seat-furniture-underlay-r58 > .seat-furniture-r54 {
  transform: rotate(var(--native-chair-rotation)) !important;
}
html body[data-view="table"] #table-view #table-stage.mesa-cartas:is([data-native-card-landscape], [data-native-card-portrait]) #seats > .seat.open-seat > .sit-button::after {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  padding: 2px 3px;
  border: 1px solid #b08568;
  border-radius: 6px;
  background: #2a2122;
  color: #fff6ea;
  font: 600 10px/1.15 Inter, 'Segoe UI', system-ui, sans-serif;
  text-shadow: none;
}
html body[data-view="table"] #table-view #table-stage.mesa-cartas[data-native-card-landscape]:not([data-has-hand="true"]) .felt-inner::after {
  background-size: min(50%, 460px) 60%;
}
html body[data-view="table"] #table-view #table-stage.mesa-cartas[data-native-card-portrait] #seats > .seat.open-seat:is([data-position="4"], [data-position="5"]) > .sit-button::after {
  left: 0;
  transform: translateY(-50%);
}
html body[data-view="table"] #table-view #table-stage.mesa-cartas[data-native-card-portrait] #seats > .seat.open-seat:is([data-position="1"], [data-position="2"]) > .sit-button::after {
  left: auto;
  right: 0;
  transform: translateY(-50%);
}
