* {
  box-sizing: border-box;
}

html {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  font-family: Arial, sans-serif;
  background: #15100b;
  color: #f5f5f5;
}

#app {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.start-screen {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  display: grid;
  place-items: center;
  background-color: #080604;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.start-screen__shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0.42)),
    radial-gradient(circle at 50% 52%, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.58) 76%);
  pointer-events: none;
}

.start-screen__content {
  position: relative;
  z-index: 1;
  align-self: end;
  display: grid;
  justify-items: center;
  gap: 10px;
  padding-bottom: min(6vh, 58px);
}

.start-menu {
  display: grid;
  justify-items: center;
  gap: 0;
}

.start-menu-button {
  width: min(370px, 72vw);
  border: 0;
  background: transparent;
  padding: 0;
  line-height: 0;
  cursor: pointer;
}

.start-menu-button img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.55));
}

.start-message {
  min-height: 22px;
  color: #ffe08a;
  font-size: 16px;
  font-weight: 700;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.8);
}

.start-message[hidden] {
  display: block;
  visibility: hidden;
}

.settings-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.72);
}

.settings-overlay[hidden] {
  display: none;
}

.settings-panel {
  width: min(720px, 94vw);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 20px;
  border: 1px solid rgba(226, 181, 84, 0.72);
  border-radius: 8px;
  background: rgba(18, 13, 9, 0.96);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.72);
  color: #f7e7b7;
}

.settings-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(226, 181, 84, 0.3);
}

.settings-panel__header h2,
.settings-section h3 {
  margin: 0;
  letter-spacing: 0;
}

.settings-panel__header h2 {
  font-size: 24px;
}

.settings-close {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(226, 181, 84, 0.5);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: #ffe49a;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.settings-section {
  padding: 18px 0 14px;
}

.settings-section h3 {
  margin-bottom: 14px;
  font-size: 14px;
  color: #d9bd78;
}

.settings-backs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  justify-items: center;
}

.settings-back {
  width: 116px;
  height: 170px;
  padding: 5px;
  border: 2px solid transparent;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.settings-back img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 4px;
}

.settings-back.is-selected {
  border-color: #f0c95f;
  background: rgba(240, 201, 95, 0.12);
  box-shadow: 0 0 18px rgba(240, 201, 95, 0.38);
}

.settings-gameplay {
  display: grid;
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid rgba(226, 181, 84, 0.24);
}

.settings-choice-group {
  display: grid;
  grid-template-columns: 110px 1fr;
  align-items: center;
  gap: 14px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.settings-choice-group legend {
  float: left;
  width: 110px;
  color: #d9bd78;
  font-size: 12px;
  font-weight: 800;
}

.settings-choice-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 8px;
}

.settings-choice {
  min-height: 42px;
  padding: 7px 9px;
  border: 1px solid rgba(226, 181, 84, 0.35);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.035);
  color: #d8c99e;
  cursor: pointer;
}

.settings-choice strong,
.settings-choice small {
  display: block;
  letter-spacing: 0;
}

.settings-choice strong {
  font-size: 11px;
}

.settings-choice small {
  margin-top: 3px;
  color: #a89566;
  font-size: 10px;
}

.settings-choice.is-selected {
  border-color: #f0c95f;
  background: rgba(73, 98, 42, 0.72);
  color: #fff0ad;
  box-shadow: 0 0 12px rgba(240, 201, 95, 0.24);
}

.settings-choice.is-selected small {
  color: #f4dda0;
}

.settings-audio {
  display: grid;
  grid-template-columns: 150px 1fr;
  align-items: center;
  gap: 24px;
  padding: 16px 0;
  border-top: 1px solid rgba(226, 181, 84, 0.24);
  border-bottom: 1px solid rgba(226, 181, 84, 0.24);
}

.settings-audio__toggle,
.settings-volume {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 800;
}

.settings-switch {
  position: relative;
  width: 58px;
  height: 30px;
  border: 1px solid rgba(226, 181, 84, 0.55);
  border-radius: 16px;
  background: #34251a;
  color: #d7c18d;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}

.settings-switch[aria-checked="true"] {
  background: #49622a;
  color: #fff0ad;
}

.settings-volume input {
  width: 100%;
  accent-color: #d4a934;
}

.settings-volume output {
  width: 34px;
  color: #ffe08a;
  text-align: right;
}

.settings-info {
  min-height: 42px;
  padding: 12px 4px 4px;
  color: #e8d9ad;
  font-size: 13px;
  text-align: center;
}

.settings-info[hidden] {
  display: block;
  visibility: hidden;
}

.settings-language-title {
  display: block;
  margin-bottom: 9px;
  color: #d9bd78;
  font-size: 11px;
}

.settings-language-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.settings-language {
  min-height: 38px;
  border: 1px solid rgba(226, 181, 84, 0.35);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.035);
  color: #d8c99e;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.settings-language.is-selected {
  border-color: #f0c95f;
  background: rgba(73, 98, 42, 0.72);
  color: #fff0ad;
  box-shadow: 0 0 10px rgba(240, 201, 95, 0.2);
}

.settings-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 18px;
  padding-top: 8px;
}

.settings-links button {
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  padding: 5px 0;
  color: #bba978;
  font-size: 12px;
  cursor: pointer;
}

.settings-links button:hover,
.settings-links button:focus-visible {
  border-bottom-color: currentColor;
  color: #ffe08a;
}

.settings-legal {
  height: min(560px, calc(100vh - 150px));
  min-height: 360px;
  padding-top: 12px;
}

.settings-legal[hidden],
[data-settings-main][hidden] {
  display: none;
}

.settings-legal__toolbar {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding-bottom: 10px;
}

.settings-legal__back {
  border: 0;
  border-bottom: 1px solid rgba(226, 181, 84, 0.45);
  background: transparent;
  padding: 6px 2px;
  color: #f1cf75;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.settings-legal__back:hover,
.settings-legal__back:focus-visible {
  color: #fff0b0;
  border-bottom-color: currentColor;
}

.settings-legal__frame {
  display: block;
  width: 100%;
  height: calc(100% - 48px);
  border: 1px solid rgba(226, 181, 84, 0.25);
  border-radius: 5px;
  background: #120d09;
}

.tournament-overlay {
  position: fixed;
  inset: 0;
  z-index: 24;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.78);
}

.tournament-overlay[hidden] {
  display: none;
}

.tournament-panel {
  width: min(940px, 96vw);
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 18px 24px 16px;
  border: 1px solid rgba(226, 181, 84, 0.72);
  border-radius: 8px;
  background: rgba(18, 13, 9, 0.97);
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.78);
  color: #f6e5b5;
}

.tournament-overlay.is-character-only .tournament-panel {
  width: min(720px, 96vw);
}

.tournament-overlay.is-character-only .tournament-heading--competition,
.tournament-overlay.is-character-only .tournament-carousel--competition,
.tournament-overlay.is-character-only .tournament-action--play {
  display: none;
}

.tournament-overlay.is-character-only .tournament-actions {
  padding-top: 22px;
}

.tournament-heading {
  margin: 0 0 10px;
  color: #f3cf70;
  font-size: 20px;
  text-align: center;
  letter-spacing: 0;
}

.tournament-heading--competition {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(226, 181, 84, 0.25);
}

.tournament-carousel {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  align-items: center;
  gap: 14px;
}

.tournament-arrow {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(226, 181, 84, 0.55);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: #ffe08a;
  font-size: 36px;
  line-height: 1;
  cursor: pointer;
}

.tournament-arrow:hover,
.tournament-arrow:focus-visible {
  border-color: #f3cf70;
  background: rgba(226, 181, 84, 0.13);
}

.tournament-character {
  position: relative;
  display: grid;
  grid-template-columns: 142px minmax(0, 1fr);
  align-items: center;
  gap: 22px;
  width: min(610px, 100%);
  min-height: 142px;
  margin: 0 auto;
  padding: 8px 14px 8px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.tournament-character:hover,
.tournament-character:focus-visible {
  border-color: rgba(226, 181, 84, 0.4);
  background: rgba(226, 181, 84, 0.05);
}

.tournament-character.is-selected {
  border-color: rgba(255, 218, 113, 0.72);
  background: rgba(131, 101, 36, 0.13);
  box-shadow: inset 0 0 24px rgba(255, 207, 80, 0.11), 0 0 16px rgba(255, 195, 59, 0.16);
}

.tournament-character img {
  display: block;
  width: 142px;
  height: 142px;
  object-fit: contain;
}

.tournament-character.is-selected img {
  filter: brightness(1.09) drop-shadow(0 0 16px rgba(255, 207, 80, 0.68));
}

.tournament-character__copy h3,
.tournament-choice__copy h3 {
  margin: 0 0 7px;
  color: #fff0b0;
  font-size: 21px;
  letter-spacing: 0;
}

.tournament-character__copy p {
  max-width: 440px;
  margin: 0 0 9px;
  color: #d8c99f;
  font-size: 14px;
  line-height: 1.4;
}

.tournament-character__selected {
  display: inline-block;
  margin: 0 10px 7px 0;
  color: #ffe08a;
  font-size: 11px;
}

.tournament-character__selected[hidden] {
  display: none;
}

.tournament-counter {
  color: #a99562;
  font-size: 11px;
  font-weight: 800;
}

.tournament-choice {
  display: grid;
  grid-template-columns: minmax(260px, 1.5fr) minmax(210px, 1fr);
  align-items: stretch;
  gap: 18px;
  width: min(750px, 100%);
  min-height: 156px;
  margin: 0 auto;
}

.tournament-choice__media {
  position: relative;
  min-height: 156px;
  overflow: hidden;
  border: 1px solid rgba(226, 181, 84, 0.42);
  border-radius: 6px;
  background: #080604;
}

.tournament-choice__media img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 156px;
  object-fit: cover;
}

.tournament-rival {
  position: absolute;
  left: 10px;
  bottom: 8px;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 20px);
  padding: 4px 10px 4px 4px;
  border: 1px solid rgba(239, 204, 111, 0.55);
  border-radius: 28px;
  background: rgba(10, 7, 4, 0.84);
  color: #ffe8a5;
  font-size: 11px;
  font-weight: 900;
}

.tournament-rival img {
  width: 44px;
  height: 44px;
  min-height: 0;
  flex: 0 0 44px;
  border-radius: 50%;
  object-fit: cover;
}

.tournament-lock {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 2;
  background: rgba(5, 4, 3, 0.62);
  color: #e8d8ac;
  font-size: 14px;
  font-weight: 900;
}

.tournament-lock[hidden] {
  display: none;
}

.tournament-choice__copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.tournament-choice__copy dl {
  margin: 0 0 8px;
}

.tournament-choice__copy dl div {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 8px;
  padding: 3px 0;
}

.tournament-choice__copy dt {
  color: #aa9764;
  font-size: 12px;
}

.tournament-choice__copy dd {
  min-width: 0;
  margin: 0;
  color: #f1db99;
  font-size: 12px;
  font-weight: 800;
}

.tournament-choice__copy dd.is-locked {
  color: #b58c7d;
}

.tournament-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding-top: 16px;
}

.tournament-action {
  width: 180px;
  height: 58px;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.tournament-action img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.tournament-action:hover:not(:disabled),
.tournament-action:focus-visible:not(:disabled) {
  filter: brightness(1.12);
  transform: translateY(-2px);
}

.tournament-action:disabled {
  cursor: not-allowed;
  filter: grayscale(0.9);
  opacity: 0.42;
}

.tournament-action[hidden] {
  display: none;
}

.mano-overlay {
  position: fixed;
  inset: 0;
  z-index: 28;
  display: grid;
  place-items: center;
  padding: 10px;
  background: rgba(0, 0, 0, 0.84);
}

.mano-overlay[hidden] {
  display: none;
}

.mano-panel {
  position: relative;
  width: min(62.5vh, 94vw, 600px);
  aspect-ratio: 2 / 3;
  overflow: hidden;
}

.mano-panel__frame {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.mano-close {
  position: absolute;
  top: 3.8%;
  right: 6.8%;
  width: 11.5%;
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.mano-close:hover,
.mano-close:focus-visible {
  outline: 2px solid rgba(255, 226, 137, 0.9);
  outline-offset: 2px;
  box-shadow: 0 0 18px rgba(255, 199, 61, 0.7);
}

.mano-player {
  position: absolute;
  top: 20.1%;
  left: 35%;
  width: 30%;
  height: 23.5%;
  display: grid;
  place-items: center;
}

.mano-player img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(255, 210, 90, 0.42));
}

.mano-reel {
  position: absolute;
  top: 56.7%;
  left: 9.5%;
  width: 81%;
  height: 24.8%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.mano-reel__item {
  flex: 0 0 20%;
  height: 100%;
  display: grid;
  place-items: center;
  opacity: 0.46;
  transform: scale(0.64);
  transition: transform 100ms ease, opacity 100ms ease, filter 100ms ease;
}

.mano-reel__item--near {
  opacity: 0.72;
  transform: scale(0.84);
}

.mano-reel__item--center {
  z-index: 2;
  opacity: 1;
  transform: scale(1.08);
  filter: drop-shadow(0 0 12px rgba(255, 210, 89, 0.85));
}

.mano-reel__item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.mano-reel.is-rolling .mano-reel__item {
  animation: manoReelShift 110ms ease both;
}

.mano-play {
  position: absolute;
  left: 28%;
  bottom: 2.2%;
  width: 44%;
  height: 8.5%;
  border: 0;
  border-radius: 14px;
  background: transparent;
  cursor: pointer;
}

.mano-play:disabled {
  background: rgba(0, 0, 0, 0.52);
  cursor: wait;
}

.mano-play:not(:disabled) {
  box-shadow: 0 0 20px rgba(255, 207, 74, 0.5);
}

.mano-play:not(:disabled):hover,
.mano-play:not(:disabled):focus-visible {
  outline: 2px solid #ffe08a;
  outline-offset: 2px;
  box-shadow: 0 0 28px rgba(255, 207, 74, 0.78);
}

@keyframes manoReelShift {
  from {
    translate: 16% 0;
    opacity: 0.35;
  }
  to {
    translate: 0 0;
  }
}

@media (max-width: 700px) {
  .tournament-overlay {
    padding: 8px;
  }

  .tournament-panel {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    padding: 14px 10px 12px;
  }

  .tournament-heading {
    font-size: 17px;
  }

  .tournament-carousel {
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    gap: 5px;
  }

  .tournament-arrow {
    width: 40px;
    height: 48px;
  }

  .tournament-character {
    grid-template-columns: 108px minmax(0, 1fr);
    gap: 10px;
    min-height: 108px;
  }

  .tournament-character img {
    width: 108px;
    height: 108px;
  }

  .tournament-character__copy h3,
  .tournament-choice__copy h3 {
    font-size: 17px;
  }

  .tournament-character__copy p {
    font-size: 12px;
  }

  .tournament-choice {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    min-height: 0;
  }

  .tournament-choice__media,
  .tournament-choice__media img {
    min-height: 112px;
    height: 112px;
  }

  .tournament-rival {
    left: 6px;
    bottom: 5px;
    padding: 3px 8px 3px 3px;
    font-size: 10px;
  }

  .tournament-rival img {
    width: 36px;
    height: 36px;
    min-height: 0;
    flex-basis: 36px;
  }

  .tournament-choice__copy {
    padding: 0 4px;
  }

  .tournament-choice__copy h3 {
    margin-bottom: 3px;
  }

  .tournament-choice__copy dl {
    margin-bottom: 3px;
  }

  .tournament-choice__copy dl div {
    grid-template-columns: 78px minmax(0, 1fr);
    padding: 1px 0;
  }

  .tournament-actions {
    gap: 8px;
    padding-top: 10px;
  }

  .tournament-action {
    width: min(150px, 42vw);
    height: 50px;
  }
}

/* Montones laterales sobre la mesa */
.escoba-seat--human .escoba-captured-pile {
  left: 14px;
  right: auto;
  bottom: 118px;
}

.escoba-seat--ai .escoba-captured-pile {
  right: 14px;
  top: 76px;
}

.escoba-captured-cross {
  z-index: 4;
  transform: translate(-10px, 7px) rotate(90deg);
  transform-origin: center;
}

.escoba-captured-top {
  z-index: 6;
  transform: translate(5px, 0);
}

.escoba-captured-pile.is-escoba .escoba-captured-top {
  animation: none;
}

.escoba-captured-pile.is-escoba .escoba-captured-cross {
  animation: escoba-cross-arrive 1s ease-in-out;
}

@keyframes escoba-cross-arrive {
  0% { transform: translate(0,0) rotate(0deg) scale(.8); opacity: .2; }
  45%, 100% { transform: translate(-10px,7px) rotate(90deg) scale(1); opacity: 1; }
}

@media (max-width: 700px) {
  .escoba-seat--human .escoba-captured-pile {
    left: 4px;
    bottom: 96px;
  }

  .escoba-seat--ai .escoba-captured-pile {
    right: 4px;
    top: 62px;
  }

  .escoba-captured-meta {
    display: none;
  }
}

/* Reparto animado adaptado de TRUCO: 3 + 3 + 4 */
.escoba-deal-layer {
  position: absolute;
  inset: 0;
  z-index: 40;
  overflow: visible;
  pointer-events: none;
}

.escoba-deal-card {
  position: absolute;
  width: 92px;
  height: 140px;
  object-fit: contain;
  border: 3px solid rgba(255,232,151,.92);
  border-radius: 6px;
  background: #eee7d8;
  box-shadow: 0 22px 26px rgba(0,0,0,.68), 0 0 18px rgba(255,218,92,.28);
  opacity: 0;
  transform-origin: center;
  animation: escoba-deal-card 860ms cubic-bezier(.16,.82,.22,1) both;
}

.escoba-deal-card--ai {
  filter: brightness(.88);
}

.escoba-table.is-dealing .escoba-hand,
.escoba-table.is-dealing .escoba-hidden-hand {
  opacity: 0;
}

.escoba-table.is-dealing .escoba-table-cards {
  opacity: 0;
}

@keyframes escoba-deal-card {
  0% {
    opacity: 0;
    transform: translate(-50%,-50%) perspective(520px) rotateX(58deg) rotateZ(-12deg) scale(.74);
  }
  10% { opacity: 1; }
  58% {
    opacity: 1;
    transform: translate(calc(-50% + var(--deal-x)),calc(-50% + var(--deal-y) - 44px)) perspective(520px) rotateX(28deg) rotateZ(calc(var(--deal-rotate) - 8deg)) scale(1.12);
    filter: brightness(1.22);
  }
  100% {
    opacity: 1;
    transform: translate(calc(-50% + var(--deal-x)),calc(-50% + var(--deal-y))) perspective(520px) rotateX(31deg) rotateZ(var(--deal-rotate)) scale(1);
    filter: brightness(1);
  }
}

@media (max-width: 700px) {
  .escoba-deal-card {
    width: 72px;
    height: 110px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .escoba-deal-card {
    animation-duration: 1ms;
    animation-delay: 0ms !important;
  }
}

/* Fondo de mesa definido por el torneo seleccionado */
.escoba-table.has-table-background::before {
  opacity: 1;
  background:
    linear-gradient(180deg, rgba(5, 7, 6, .72), rgba(8, 6, 4, .18) 32%, rgba(4, 6, 5, .66)),
    radial-gradient(ellipse at 50% 48%, transparent 20%, rgba(0,0,0,.38) 92%);
}

.escoba-table.has-table-background .escoba-board {
  background: rgba(8, 10, 9, .14);
}

.escoba-table.has-table-background .escoba-board::before {
  background:
    radial-gradient(ellipse at 50% 42%, rgba(195, 151, 82, .13), transparent 58%),
    rgba(18, 12, 8, .34);
  backdrop-filter: blur(1px);
}

.intro-screen {
  position: fixed;
  inset: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #050505;
  z-index: 50;
}

.intro-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      circle at center,
      rgba(255, 190, 90, 0.08),
      rgba(0, 0, 0, 0) 46%
    ),
    #050505;
}

.intro-stage {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.intro-logo {
  position: absolute;
  max-width: min(1180px, 92vw);
  max-height: 82vh;
  object-fit: contain;
  opacity: 0;
  filter: drop-shadow(0 10px 26px rgba(0, 0, 0, 0.55));
}

.intro-pucara {
  max-width: min(620px, 78vw);
  max-height: 42vh;
  animation: introLogoOne 2s ease forwards;
}

.intro-presentacion {
  animation: introLogoTwo 3.2s ease forwards;
  animation-delay: 1.8s;
}

.intro-exit {
  animation: introExit 520ms ease forwards;
}

@keyframes introLogoOne {
  0% {
    opacity: 0;
    transform: scale(0.86);
  }

  18%,
  72% {
    opacity: 1;
    transform: scale(1);
  }

  100% {
    opacity: 0;
    transform: scale(1.06);
  }
}

@keyframes introLogoTwo {
  0% {
    opacity: 0;
    transform: scale(0.86);
  }

  18%,
  78% {
    opacity: 1;
    transform: scale(1);
  }

  100% {
    opacity: 0;
    transform: scale(1.04);
  }
}

@keyframes introExit {
  0% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

.table-screen {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 12px;
  padding: 16px;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  position: relative;
  overflow: hidden;
  contain: layout paint;
}

.table-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.22);
  pointer-events: none;
}

.table-screen > * {
  position: relative;
  z-index: 1;
}

.table-back {
  position: absolute;
  top: 62px;
  right: 22px;
  z-index: 8;
  width: min(118px, 16vw);
  border: 0;
  background: transparent;
  padding: 0;
  line-height: 0;
  cursor: pointer;
}

.table-back img {
  display: block;
  width: 100%;
  height: auto;
}

.table-screen__hud,
.table-screen__played,
.table-screen__hand {
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(0, 0, 0, 0.42);
  border-radius: 8px;
  backdrop-filter: blur(2px);
}

.table-screen__hud {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  font-weight: 700;
}

.table-screen__message {
  min-height: 28px;
  padding: 6px 10px;
  color: #ffe08a;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.75);
}

.table-screen__message[hidden] {
  display: block;
  visibility: hidden;
}

.table-screen__body {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) 178px;
  gap: 4px;
  min-height: 0;
  overflow: visible;
}

.table-deck {
  position: absolute;
  left: 29%;
  top: 48%;
  width: 88px;
  height: 132px;
  z-index: 2;
  pointer-events: none;
  transform: translate(-50%, -50%) perspective(520px) rotateX(52deg) rotateZ(-7deg) skewX(-2deg);
  transform-origin: center bottom;
  filter: drop-shadow(0 18px 10px rgba(0, 0, 0, 0.62));
}

.table-deck__card,
.table-deck__image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 6px;
}

.table-deck__card {
  border: 1px solid rgba(245, 225, 175, 0.72);
  background: #e8dfca;
}

.table-deck__card--back {
  transform: translate(-7px, 7px);
}

.table-deck__card--middle {
  transform: translate(-3px, 3px);
}

.table-deck__card--base {
  transform: translate(-10px, 10px);
  background: #cfc4aa;
}

.table-deck__image {
  object-fit: contain;
  border: 1px solid rgba(245, 225, 175, 0.8);
  background: #eee7d8;
}

.table-deal-layer {
  position: absolute;
  inset: 0;
  z-index: 7;
  overflow: visible;
  pointer-events: none;
}

.table-deal-card {
  position: absolute;
  width: 78px;
  height: 118px;
  object-fit: contain;
  border: 1px solid rgba(245, 225, 175, 0.82);
  border-radius: 6px;
  background: #eee7d8;
  box-shadow: 0 15px 18px rgba(0, 0, 0, 0.48);
  opacity: 0;
  transform-origin: center;
  animation: table-deal-card 520ms cubic-bezier(0.2, 0.72, 0.24, 1) both;
}

.table-deal-card--opponent {
  filter: brightness(0.88);
}

.table-screen__body.is-dealing .table-screen__hand {
  opacity: 0;
}

@keyframes table-deal-card {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) perspective(520px) rotateX(52deg) rotateZ(-7deg) scale(0.92);
  }
  12% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    transform: translate(calc(-50% + var(--deal-x)), calc(-50% + var(--deal-y))) perspective(520px) rotateX(34deg) rotateZ(var(--deal-rotate)) scale(1);
  }
}

.table-screen__players {
  position: absolute;
  inset: 0;
  padding: 0;
  pointer-events: none;
  z-index: 3;
}

.table-player {
  position: absolute;
  left: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 96px;
  height: 96px;
  padding: 0;
  border: 0;
  background: transparent;
  pointer-events: none;
}

.table-player:nth-child(1) {
  top: 16px;
}

.table-player:nth-child(2) {
  bottom: 16px;
}

.table-player[data-active-turn="true"] {
  outline: 0;
}

.table-player__avatar {
  width: 96px;
  height: 96px;
  object-fit: contain;
  border-radius: 50%;
  filter:
    drop-shadow(0 4px 8px rgba(0, 0, 0, 0.75))
    drop-shadow(0 0 0 rgba(255, 224, 138, 0));
}

.table-player[data-active-turn="true"] .table-player__avatar {
  filter:
    drop-shadow(0 4px 8px rgba(0, 0, 0, 0.75))
    drop-shadow(0 0 14px rgba(255, 224, 138, 0.82));
}

.table-score-markers {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}

.score-marker {
  position: absolute;
  right: 22px;
  display: grid;
  justify-items: end;
  gap: 7px;
  width: 250px;
  color: #ffe08a;
  text-align: right;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.86);
}

.score-marker--opponent {
  top: 116px;
}

.score-marker--local {
  bottom: 82px;
}

.score-marker__meta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 1px solid rgba(255, 224, 138, 0.42);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(40, 24, 9, 0.74), rgba(0, 0, 0, 0.56));
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.34);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
}

.score-marker__label,
.score-marker__phase {
  text-transform: uppercase;
}

.score-marker__number {
  min-width: 18px;
  color: #ffffff;
  text-align: center;
}

.score-marker__beans {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  min-height: 62px;
}

.score-bean-pile {
  position: relative;
  display: block;
  width: 76px;
  height: 58px;
}

.score-bean-pile[data-count="0"] {
  opacity: 0;
}

.score-bean {
  position: absolute;
  width: 34px;
  height: auto;
  object-fit: contain;
  filter:
    drop-shadow(0 5px 5px rgba(0, 0, 0, 0.82))
    drop-shadow(0 0 7px rgba(255, 210, 110, 0.2));
}

.score-bean--1 {
  left: 0;
  bottom: 3px;
  transform: rotate(-17deg);
}

.score-bean--2 {
  left: 14px;
  bottom: 0;
  transform: rotate(8deg);
}

.score-bean--3 {
  left: 28px;
  bottom: 3px;
  transform: rotate(-7deg);
}

.score-bean--4 {
  left: 42px;
  bottom: 0;
  transform: rotate(15deg);
}

.score-bean--5 {
  left: 21px;
  bottom: 25px;
  transform: rotate(-2deg);
}

.table-screen__played {
  display: grid;
  grid-template-rows: 1fr 1fr;
  align-items: stretch;
  justify-content: stretch;
  gap: 12px;
  min-height: 210px;
  padding: 18px 12px;
  backdrop-filter: none;
  perspective: 520px;
  perspective-origin: 50% 28%;
  overflow: visible;
}

.table-played-lane {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 94px;
  pointer-events: none;
  overflow: visible;
}

.table-played-lane--opponent {
  align-items: end;
}

.table-played-lane--local {
  align-items: start;
}

.table-screen__hand {
  display: flex;
  align-items: start;
  justify-content: center;
  gap: 10px;
  padding: 10px 12px 34px;
  min-height: 178px;
  transform: translateY(-34px);
  perspective: 520px;
  perspective-origin: 50% 0%;
  overflow: visible;
}

.table-card,
.table-played-card {
  width: 96px;
  height: 146px;
  min-height: 146px;
  display: grid;
  place-items: center;
  padding: 0px;
  border: 0;
  border-radius: 8px;
  background: #f7f3e8;
  color: #111;
  font-weight: 700;
  cursor: pointer;
  transform-style: preserve-3d;
  overflow: visible;
}

.table-card[data-selected="true"] {
  z-index: 5;
  box-shadow:
    0 0 0 4px #ffe08a,
    0 26px 34px rgba(0, 0, 0, 0.48),
    0 0 24px rgba(255, 224, 138, 0.78);
}

.table-card img,
.table-played-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 8px;
}

.table-card span,
.table-played-card span {
  display: block;
  width: 100%;
  height: 100%;
  text-align: center;
  overflow: visible;
}

.table-played-card {
  cursor: default;
  box-shadow: 0 20px 16px rgba(0, 0, 0, 0.38);
}

.table-played-card[data-table-side="opponent"] {
  transform: rotateX(56deg) scale(0.82) translateY(12px);
  transform-origin: center bottom;
}

.table-played-card[data-table-side="local"] {
  transform: rotateX(42deg) scale(0.94) translateY(-6px);
  transform-origin: center top;
}

.table-card {
  box-shadow: 0 18px 14px rgba(0, 0, 0, 0.34);
}

.table-card:nth-child(1) {
  transform: rotateX(34deg) rotateZ(-3deg) translateY(8px);
  transform-origin: center top;
}

.table-card:nth-child(2) {
  transform: rotateX(38deg) translateY(3px);
  transform-origin: center top;
}

.table-card:nth-child(3) {
  transform: rotateX(34deg) rotateZ(3deg) translateY(8px);
  transform-origin: center top;
}
.table-card:nth-child(1)[data-selected="true"] {
  transform: rotateX(30deg) rotateZ(-3deg) translateY(-24px) scale(1.06);
}

.table-card:nth-child(2)[data-selected="true"] {
  transform: rotateX(34deg) translateY(-28px) scale(1.06);
}

.table-card:nth-child(3)[data-selected="true"] {
  transform: rotateX(30deg) rotateZ(3deg) translateY(-24px) scale(1.06);
}
.table-screen__actions {
  display: flex;
  justify-content: center;
  position: relative;
  min-height: 58px;
  margin-top: -42px;
  z-index: 6;
}

.table-call-trigger,
.table-call-button {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.table-call-trigger:disabled,
.table-card:disabled {
  cursor: default;
  pointer-events: none;
}

.table-call-trigger:disabled {
  opacity: 0.72;
}

.table-card:disabled {
  filter: brightness(0.86);
}

.table-call-trigger {
  width: min(218px, 46vw);
  align-self: end;
}

.table-call-trigger img,
.table-call-button img {
  display: block;
  width: 100%;
  height: auto;
  opacity: 1;
  filter: none;
  image-rendering: auto;
}

.table-call-overlay {
  position: absolute;
  top: auto;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: min(920px, calc(100vw - 32px));
  height: 276px;
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  pointer-events: none;
  z-index: 7;
}

.table-call-overlay[hidden] {
  display: none;
}

.table-call-button {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: min(140px, 22vw);
  min-width: 0;
  min-height: 0;
  line-height: 0;
  opacity: 1;
  filter: none;
  box-shadow: none;
  pointer-events: auto;
  transform: translate(calc(-50% + var(--fan-x, 0px)), var(--fan-y, -190px));
}

.table-call-button img {
  width: 100%;
  max-height: none;
  object-fit: contain;
  opacity: 1;
  filter: none;
}

@media (max-width: 700px) {
  .settings-overlay {
    padding: 8px;
  }

  .settings-panel {
    max-height: calc(100vh - 16px);
    padding: 14px;
  }

  .settings-panel__header h2 {
    font-size: 19px;
  }

  .settings-backs {
    gap: 8px;
  }

  .settings-back {
    width: min(94px, 27vw);
    height: min(138px, 40vw);
  }

  .settings-audio {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .settings-choice-group {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .settings-choice-group legend {
    float: none;
    width: auto;
  }

  .settings-choice-row {
    gap: 5px;
  }

  .settings-volume {
    display: grid;
    grid-template-columns: auto 1fr 30px;
  }

  .table-screen {
    padding: 8px;
  }

  .table-back {
    top: 50px;
    right: 10px;
    width: min(96px, 25vw);
  }

  .table-card,
  .table-played-card {
    width: 78px;
    height: 120px;
    min-height: 120px;
  }

  .table-screen__played {
    gap: 8px;
    min-height: 196px;
    padding: 14px 8px;
  }

  .table-played-lane {
    gap: 10px;
    min-height: 82px;
  }

  .table-screen__hand {
    min-height: 148px;
    padding: 8px 8px 28px;
    transform: translateY(-28px);
  }

  .table-screen__body {
    grid-template-rows: minmax(0, 1fr) 148px;
  }

  .table-deck {
    left: 24%;
    top: 46%;
    width: 62px;
    height: 94px;
  }

  .table-deal-card {
    width: 62px;
    height: 94px;
  }

  .table-screen__players {
    left: 0;
  }

  .table-player {
    left: 8px;
    width: 64px;
    height: 64px;
  }

  .table-player:nth-child(1) {
    top: 8px;
  }

  .table-player:nth-child(2) {
    bottom: 8px;
  }

  .table-player__avatar {
    width: 64px;
    height: 64px;
  }

  .score-marker {
    right: 2px;
    width: 174px;
  }

  .score-marker--opponent {
    top: 100px;
  }

  .score-marker--opponent .score-marker__beans {
    justify-self: end;
    transform: translateX(8px);
  }

  .score-marker--local {
    bottom: clamp(150px, 25vh, 210px);
  }

  .score-marker__meta {
    font-size: 10px;
    padding: 4px 7px;
  }

  .score-marker__beans {
    gap: 2px;
    min-height: 43px;
  }

  .score-bean-pile {
    width: 54px;
    height: 42px;
  }

  .score-bean {
    width: 24px;
  }

  .score-bean--2 {
    left: 10px;
  }

  .score-bean--3 {
    left: 20px;
  }

  .score-bean--4 {
    left: 30px;
  }

  .score-bean--5 {
    left: 15px;
    bottom: 18px;
  }

  .table-call-overlay {
    bottom: max(0px, env(safe-area-inset-bottom));
    width: min(100vw, 420px);
    height: 238px;
  }

  .table-call-button {
    width: min(96px, 27vw);
    min-width: 0;
    filter: drop-shadow(0 5px 5px rgba(0, 0, 0, 0.58));
  }

  .table-call-button img {
    max-height: none;
  }

  .table-call-trigger {
    width: min(178px, 48vw);
  }

  .table-screen__actions {
    padding-bottom: max(4px, env(safe-area-inset-bottom));
  }

  .table-screen.is-call-menu-open .table-screen__hand {
    opacity: 0.16;
    transition: opacity 120ms ease;
  }

  .table-screen.is-call-menu-open .table-call-trigger {
    filter: drop-shadow(0 0 9px rgba(255, 214, 96, 0.42));
  }

  .table-screen__hud,
  .table-screen__hand {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .table-deck {
    filter: drop-shadow(0 9px 6px rgba(0, 0, 0, 0.5));
  }

  .table-card,
  .table-played-card {
    box-shadow: 0 9px 8px rgba(0, 0, 0, 0.34);
  }

  .table-card[data-selected="true"] {
    box-shadow:
      0 0 0 2px #ffe08a,
      0 12px 14px rgba(0, 0, 0, 0.42);
  }

  .table-player__avatar {
    filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.7));
  }

  .table-player[data-active-turn="true"] .table-player__avatar {
    filter:
      drop-shadow(0 3px 5px rgba(0, 0, 0, 0.7))
      drop-shadow(0 0 7px rgba(255, 224, 138, 0.72));
  }

  .score-bean {
    filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.72));
  }

  .table-deal-card {
    backface-visibility: hidden;
    will-change: transform, opacity;
    box-shadow: 0 8px 9px rgba(0, 0, 0, 0.4);
  }

  .table-call-button {
    backface-visibility: hidden;
    will-change: transform;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}

/* ESCOBA DEL 15 TABLE — composición visual adaptada de la mesa base */
.escoba-table {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: 56px minmax(90px, .25fr) minmax(180px, .44fr) 42px minmax(126px, .31fr) 58px;
  padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  color: #f6e5ae;
  background:
    radial-gradient(ellipse at 50% 46%, rgba(116, 78, 35, .24), transparent 48%),
    linear-gradient(145deg, #21170e 0%, #0d0b08 52%, #1a120c 100%);
  font-family: Arial, sans-serif;
}

.escoba-table::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .38;
  background:
    repeating-linear-gradient(90deg, transparent 0 84px, rgba(255,255,255,.018) 85px),
    linear-gradient(180deg, rgba(0,0,0,.48), transparent 30%, rgba(0,0,0,.46));
}

.escoba-hud {
  display: grid;
  grid-template-columns: 42px 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  min-height: 0;
  padding: 6px 10px;
  border: 1px solid rgba(230, 194, 91, .48);
  border-radius: 6px;
  background: rgba(7, 8, 7, .88);
  box-shadow: 0 8px 22px rgba(0,0,0,.34);
}

.escoba-back {
  width: 36px;
  height: 34px;
  border: 1px solid #cba94f;
  border-radius: 5px;
  color: #f5dc8b;
  background: #22190e;
  font-size: 19px;
  cursor: pointer;
}

.escoba-score {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 9px;
  color: #f0d681;
}

.escoba-score span {
  color: #c9b67a;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.escoba-score strong {
  display: block;
  width: auto;
  height: auto;
  border-radius: 0;
  color: #f0d681;
  background: transparent;
  font-size: 25px;
}

.escoba-round {
  padding: 6px 12px;
  color: #f4dd91;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.escoba-round small {
  display: block;
  margin-top: 2px;
  color: #9aaea0;
  font-size: 9px;
}

.escoba-seat {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 0;
  color: #f6e5ae;
  background: transparent;
  transition: opacity .25s, filter .25s;
}

.escoba-seat:not(.is-turn) {
  opacity: .68;
  filter: saturate(.76) brightness(.86);
}

.escoba-seat.is-turn {
  box-shadow: none;
}

.escoba-seat strong {
  color: #f2d77e;
  font-size: 12px;
  text-transform: uppercase;
}

.escoba-seat span {
  color: #9cb2a1;
  font-size: 10px;
  font-weight: 900;
}

.escoba-hidden-hand,
.escoba-hand {
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 900px;
}

.escoba-hidden-hand img {
  width: clamp(42px, 4vw, 62px);
  margin-left: clamp(-24px, -1.4vw, -14px);
  border: 3px solid #f3eee0;
  border-radius: 6px;
  box-shadow: 0 9px 13px rgba(0,0,0,.42);
  transform: rotateX(18deg);
}

.escoba-hidden-hand img:first-child {
  margin-left: 0;
}

.escoba-board {
  position: relative;
  min-height: 0;
  display: grid;
  grid-template-columns: 100px minmax(280px, 720px) 100px;
  align-items: center;
  justify-content: center;
  gap: clamp(20px, 4vw, 70px);
  padding: 10px 22px;
  border-block: 1px solid rgba(224, 193, 102, .22);
  background: rgba(8, 10, 9, .22);
}

.escoba-deck {
  position: relative;
  left: auto;
  display: grid;
  place-items: center;
  color: #ead48d;
}

.escoba-deck img {
  width: clamp(66px, 6.4vw, 96px);
  border: 3px solid #f4efde;
  border-radius: 6px;
  box-shadow: 8px 10px 15px rgba(0,0,0,.5), 4px 4px 0 #918874, 7px 7px 0 #b2aa97;
  transform: perspective(520px) rotateY(-10deg) rotateX(7deg);
}

.escoba-deck b {
  position: static;
  margin-top: 9px;
  padding: 3px 9px;
  border-radius: 3px;
  color: #e9d58f;
  background: rgba(5,8,6,.82);
  font-size: 11px;
}

.escoba-table-cards {
  min-height: 150px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1.1vw, 16px);
  max-width: none;
  padding: 10px 18px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.escoba-card {
  padding: 0;
  border: 0;
  background: transparent;
  transition: transform .16s, filter .16s;
}

.escoba-card img {
  display: block;
  width: clamp(68px, 6.5vw, 100px);
  aspect-ratio: .58;
  object-fit: cover;
  border: 3px solid #f3eee0;
  border-radius: 6px;
  box-shadow: 0 9px 13px rgba(0,0,0,.43);
}

.escoba-card:not(:disabled) {
  cursor: pointer;
}

.escoba-card:not(:disabled):hover,
.escoba-card.is-selected {
  z-index: 5;
  transform: translateY(-14px) scale(1.05);
}

.escoba-card.is-selected img {
  border-color: #fff2a8;
  filter: drop-shadow(0 0 10px rgba(255, 222, 95, .9));
}

.escoba-message {
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 6px 12px;
  border: 0;
  color: #f7e3a0;
  background: rgba(5, 9, 7, .76);
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}

.escoba-seat--human {
  align-self: stretch;
  grid-template-rows: auto 1fr auto;
  justify-content: stretch;
  background: transparent;
  border: 0;
}

.escoba-hand {
  min-height: 0;
  align-self: center;
}

.escoba-card--hand {
  position: relative;
  margin-left: clamp(-10px, -.25vw, -3px);
  transform: perspective(850px) rotateX(8deg);
  transform-origin: 50% 118%;
}

.escoba-card--hand:first-child {
  margin-left: 0;
}

.escoba-actions {
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  border-top: 1px solid rgba(228,196,101,.38);
  background: rgba(5,9,7,.86);
}

.escoba-actions button,
.escoba-result button {
  min-width: 0;
  min-height: 40px;
  padding: 0 22px;
  border: 1px solid #dfc264;
  border-radius: 5px;
  color: #fff1b6;
  background: #41301a;
  font-size: 11px;
  font-weight: 900;
  box-shadow: none;
}

.escoba-actions button:disabled {
  opacity: .38;
}

.escoba-result {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(3, 4, 3, .76);
}

.escoba-result section {
  width: min(440px, 92vw);
  min-width: 0;
  padding: 28px;
  border: 1px solid #d7b957;
  border-radius: 7px;
  color: #f7e7ae;
  background: #11110e;
  box-shadow: 0 22px 70px rgba(0,0,0,.68);
}

.escoba-result--final section {
  text-align: center;
  border-width: 2px;
}

.escoba-result--final.is-victory section {
  border-color: #e9cd69;
  box-shadow: 0 22px 70px rgba(0,0,0,.72), 0 0 42px rgba(233,205,105,.18);
}

.escoba-result--final.is-defeat section {
  border-color: #a75b4d;
  box-shadow: 0 22px 70px rgba(0,0,0,.72), 0 0 42px rgba(167,91,77,.16);
}

.escoba-result__eyebrow,
.escoba-result__score small {
  display: block;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .16em;
  opacity: .72;
}

.escoba-result--final h2 {
  margin: 8px 0;
  font-size: clamp(30px, 7vw, 52px);
  line-height: 1;
}

.escoba-result--final.is-defeat h2 {
  color: #df8776;
}

.escoba-result__message {
  margin: 8px 0 18px;
}

.escoba-result__score {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin: 0 auto 22px;
}

.escoba-result__score b {
  display: block;
  font-size: 34px;
  line-height: 1;
}

.escoba-result__actions {
  display: grid;
  gap: 10px;
}

.escoba-result__actions button {
  width: 100%;
}

.escoba-result__actions button.is-secondary {
  border-color: rgba(223,194,100,.45);
  color: #d8cda9;
  background: transparent;
}

@media (max-width: 700px) {
  .escoba-table {
    grid-template-rows: 48px minmax(72px,.22fr) minmax(150px,.45fr) 36px minmax(112px,.33fr) 52px;
    padding: max(5px, env(safe-area-inset-top)) max(5px, env(safe-area-inset-right)) max(5px, env(safe-area-inset-bottom)) max(5px, env(safe-area-inset-left));
  }

  .escoba-hud {
    grid-template-columns: 34px 1fr 1fr;
    gap: 5px;
    padding: 5px 6px;
  }

  .escoba-round {
    display: none;
  }

  .escoba-score span {
    display: none;
  }

  .escoba-score strong {
    font-size: 19px;
  }

  .escoba-board {
    grid-template-columns: 58px minmax(190px,1fr) 20px;
    gap: 8px;
    padding: 7px 5px;
  }

  .escoba-deck img {
    width: 54px;
  }

  .escoba-table-cards {
    min-height: 130px;
    gap: 6px;
    padding: 7px 3px;
  }

  .escoba-card img {
    width: clamp(54px, 16vw, 72px);
  }

  .escoba-hidden-hand img {
    width: 38px;
    margin-left: -17px;
  }

  .escoba-message {
    font-size: 9px;
  }
}

@media (max-height: 620px) and (orientation: landscape) {
  .escoba-table {
    grid-template-rows: 44px 68px minmax(140px,1fr) 30px 100px 48px;
  }

  .escoba-card img {
    width: 58px;
  }
}

.escoba-player-identity {
  position: absolute;
  left: 4px;
  top: 4px;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 8px;
}

.escoba-seat--human .escoba-player-identity {
  top: auto;
  bottom: 2px;
}

.escoba-player-identity img {
  width: clamp(58px, 6.5vw, 88px);
  aspect-ratio: 1;
  object-fit: contain;
  filter: drop-shadow(0 7px 8px rgba(0,0,0,.65));
}

.escoba-seat.is-turn .escoba-player-identity img {
  filter: drop-shadow(0 0 10px rgba(223,190,82,.72)) drop-shadow(0 7px 8px rgba(0,0,0,.65));
}

.escoba-player-identity > div {
  display: grid;
  gap: 2px;
  padding: 5px 8px;
  border-left: 2px solid #d0ad54;
  background: rgba(6,9,8,.72);
}

.escoba-player-identity strong {
  color: #f6e5ae;
  font-size: 11px;
}

.escoba-player-identity small {
  color: #92bea0;
  font-size: 9px;
  font-weight: 900;
}

@media (max-width: 700px) {
  .escoba-player-identity img { width: 48px; }
  .escoba-player-identity > div { padding: 3px 5px; }
  .escoba-player-identity strong { display: none; }
}

/* Composición definitiva de mesa y cartas */
.escoba-board {
  isolation: isolate;
  grid-template-columns: 112px minmax(360px, 760px) 112px;
  overflow: visible;
}

.escoba-board::before {
  content: none;
  position: absolute;
  inset: 7% 8%;
  z-index: -1;
  border: 10px solid #3b2615;
  border-radius: 48% / 42%;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(153, 111, 56, .24), transparent 55%),
    linear-gradient(145deg, #4a311c, #21160e 52%, #3b2717);
  box-shadow:
    inset 0 0 0 2px rgba(240, 205, 122, .24),
    inset 0 0 55px rgba(0,0,0,.65),
    0 18px 40px rgba(0,0,0,.55);
}

.escoba-board::after {
  content: none;
  position: absolute;
  bottom: 10%;
  left: 50%;
  z-index: -1;
  transform: translateX(-50%);
  color: rgba(239, 211, 143, .16);
  font-size: clamp(12px, 1.5vw, 21px);
  font-weight: 900;
  letter-spacing: .22em;
  white-space: nowrap;
}

.escoba-deck {
  z-index: 3;
  justify-self: end;
  transform: translateX(18px);
}

.escoba-table-cards {
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(4, minmax(64px, 100px));
  grid-auto-rows: minmax(92px, 142px);
  align-content: center;
  justify-content: center;
  gap: clamp(8px, 1.1vw, 15px);
  width: 100%;
  min-height: 100%;
}

.escoba-card--table {
  align-self: center;
  justify-self: center;
  transform: rotate(calc((var(--table-index) - 1.5) * .7deg));
}

.escoba-card--table:not(:disabled):hover,
.escoba-card--table.is-selected {
  transform: translateY(-12px) scale(1.06) rotate(calc((var(--table-index) - 1.5) * .7deg));
}

.escoba-hidden-hand {
  transform: translateY(2px);
}

.escoba-hidden-hand img {
  margin-left: -18px;
  transform:
    perspective(850px)
    rotateX(16deg)
    rotate(calc((var(--card-index) - (var(--card-count) - 1) / 2) * 7deg));
  transform-origin: 50% 118%;
}

.escoba-hidden-hand img:first-child {
  margin-left: 0;
}

.escoba-hand {
  overflow: visible;
  transform: translateY(-2px);
}

.escoba-card--hand {
  width: clamp(74px, 8vw, 112px);
  margin-left: clamp(-21px, -1.2vw, -11px);
  transform:
    perspective(900px)
    rotateX(7deg)
    rotate(calc((var(--card-index) - (var(--card-count) - 1) / 2) * 6deg));
  transform-origin: 50% 120%;
}

.escoba-card--hand img {
  width: 100%;
}

.escoba-card--hand:first-child {
  margin-left: 0;
}

.escoba-card--hand:not(:disabled):hover,
.escoba-card--hand.is-selected {
  transform:
    perspective(900px)
    rotateX(3deg)
    rotate(calc((var(--card-index) - (var(--card-count) - 1) / 2) * 3deg))
    translateY(-20px)
    scale(1.06);
}

.escoba-seat--ai {
  padding-bottom: 0;
}

.escoba-seat--human {
  padding-top: 0;
}

@media (max-width: 700px) {
  .escoba-board {
    grid-template-columns: 54px minmax(220px, 1fr) 18px;
  }

  .escoba-board::before {
    inset: 5% 2%;
    border-width: 6px;
  }

  .escoba-table-cards {
    grid-template-columns: repeat(4, minmax(48px, 70px));
    grid-auto-rows: minmax(78px, 108px);
    gap: 5px;
  }

  .escoba-card--hand {
    width: clamp(64px, 20vw, 82px);
    margin-left: -16px;
  }

  .escoba-hidden-hand img {
    margin-left: -19px;
  }
}

@media (max-width: 420px) {
  .escoba-table-cards {
    grid-template-columns: repeat(2, minmax(54px, 72px));
    grid-auto-rows: 88px;
  }

  .escoba-board::after {
    display: none;
  }
}

/* Montones de cartas capturadas */
.escoba-captured-pile {
  position: absolute;
  right: 10px;
  top: 5px;
  z-index: 7;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 142px;
}

.escoba-seat--human .escoba-captured-pile {
  top: auto;
  bottom: 3px;
}

.escoba-captured-stack {
  position: relative;
  width: 48px;
  height: 72px;
}

.escoba-captured-stack img {
  position: absolute;
  inset: 0;
  width: 45px;
  aspect-ratio: .58;
  object-fit: cover;
  border: 2px solid #eee7d4;
  border-radius: 4px;
  box-shadow: 0 5px 8px rgba(0,0,0,.45);
}

.escoba-captured-back--0 { transform: translate(7px, 5px) rotate(3deg); }
.escoba-captured-back--1 { transform: translate(5px, 3px) rotate(-2deg); }
.escoba-captured-back--2 { transform: translate(3px, 2px) rotate(1deg); }
.escoba-captured-back--3 { transform: translate(1px, 1px); }

.escoba-captured-top {
  z-index: 5;
  transition: transform .22s ease;
}

.escoba-captured-empty {
  display: grid;
  place-items: center;
  width: 45px;
  height: 68px;
  border: 1px dashed rgba(222, 194, 111, .48);
  border-radius: 4px;
  color: #9e9069;
  font-size: 7px;
  font-weight: 900;
  text-align: center;
}

.escoba-captured-meta {
  display: grid;
  gap: 3px;
  padding: 6px 8px;
  border-left: 2px solid #b99948;
  background: rgba(5,8,6,.7);
}

.escoba-captured-meta strong {
  color: #f3dc91;
  font-size: 12px;
}

.escoba-captured-meta span {
  color: #b9c9bb;
  font-size: 11px;
}

.escoba-captured-pile.is-receiving {
  animation: escoba-pile-receive 420ms ease-out;
}

.escoba-captured-pile.is-escoba .escoba-captured-top {
  animation: escoba-cross-card 1s ease-in-out;
}

@keyframes escoba-pile-receive {
  0% { transform: scale(.92); filter: brightness(1); }
  55% { transform: scale(1.09); filter: brightness(1.4); }
  100% { transform: scale(1); filter: brightness(1); }
}

@keyframes escoba-cross-card {
  0%, 100% { transform: rotate(0); }
  30%, 78% { transform: rotate(90deg) scale(1.05); }
}

.escoba-flying-card {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  object-fit: cover;
  border: 2px solid #f2ead7;
  border-radius: 5px;
  box-shadow: 0 10px 18px rgba(0,0,0,.55);
}

@media (max-width: 700px) {
  .escoba-captured-pile {
    right: 3px;
    min-width: 96px;
    gap: 4px;
  }

  .escoba-captured-stack {
    width: 36px;
    height: 55px;
  }

  .escoba-captured-stack img,
  .escoba-captured-empty {
    width: 34px;
    height: 52px;
  }

  .escoba-captured-meta {
    padding: 4px;
  }

  .escoba-captured-meta strong,
  .escoba-captured-meta span {
    font-size: 8px;
  }
}

/* Marcadores junto a cada jugador */
.escoba-hud {
  grid-template-columns: minmax(82px, 126px) 1fr auto;
}

.escoba-back {
  width: min(142px, 21vw);
  height: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  line-height: 0;
}

.escoba-back img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 5px 8px rgba(0,0,0,.5));
}

.escoba-round {
  justify-self: center;
}

.escoba-game-title {
  justify-self: end;
  padding-right: 8px;
  color: #c9b67a;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .12em;
}

.escoba-player-identity {
  gap: 7px;
}

.escoba-player-identity .escoba-player-copy {
  border-left: 2px solid #d0ad54;
}

.escoba-player-identity .escoba-player-score {
  min-width: 58px;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 3px;
  padding: 7px 10px;
  border: 1px solid rgba(224, 194, 100, .55);
  border-radius: 5px;
  background: rgba(25, 18, 10, .9);
  box-shadow: 0 5px 12px rgba(0,0,0,.34);
}

.escoba-player-identity .escoba-player-score strong {
  display: block;
  color: #f2d77e;
  font-size: 23px;
  line-height: 1;
}

.escoba-player-identity .escoba-player-score small {
  color: #bcae80;
  font-size: 10px;
}

@media (max-width: 700px) {
  .escoba-hud {
    grid-template-columns: minmax(72px, 100px) 1fr auto;
  }

  .escoba-game-title {
    font-size: 8px;
  }

  .escoba-player-identity .escoba-player-score {
    min-width: 46px;
    padding: 5px 7px;
  }

  .escoba-player-identity .escoba-player-score strong {
    display: block;
    font-size: 18px;
  }
}

/* Ajuste de jerarquía, espacio e interacción */
.escoba-table {
  grid-template-rows: 48px 76px minmax(260px, 1fr) 34px 132px 50px;
}

.escoba-hud {
  padding-block: 4px;
}

.escoba-board {
  padding-block: 5px;
}

.escoba-table-cards {
  grid-template-columns: repeat(4, minmax(76px, 114px));
  grid-auto-rows: minmax(112px, 158px);
  max-height: 100%;
  gap: clamp(8px, 1vw, 14px);
}

.escoba-card--table img {
  width: clamp(78px, 7.35vw, 114px);
}

.escoba-seat--human {
  position: relative;
  z-index: 5;
  transform: translateY(-46px);
  margin-bottom: -46px;
  padding-bottom: 3px;
}

.escoba-hand {
  min-height: 106px;
  align-items: flex-end;
}

.escoba-actions {
  position: relative;
  z-index: 7;
  min-height: 50px;
  padding: 5px 12px max(5px, env(safe-area-inset-bottom));
}

.escoba-seat span {
  font-size: 12px;
  letter-spacing: .01em;
}

.escoba-player-identity strong {
  font-size: 13px;
}

.escoba-player-identity small {
  font-size: 10px;
}

.escoba-card--hand.is-selected {
  transform:
    perspective(900px)
    rotateX(2deg)
    rotate(calc((var(--card-index) - (var(--card-count) - 1) / 2) * 3deg))
    translateY(-27px)
    scale(1.07);
}

.escoba-card--table.is-capture-option:not(.is-selected) img {
  border-color: #cfb660;
  filter: drop-shadow(0 0 5px rgba(230, 196, 84, .45));
}

.escoba-card--table.is-valid-capture img {
  border-color: #ffe486;
  box-shadow: 0 0 0 2px rgba(255, 224, 112, .7), 0 0 18px rgba(255, 206, 65, .82), 0 10px 16px rgba(0,0,0,.48);
}

.escoba-deck.is-dealing img {
  animation: escoba-deck-deal 420ms ease-out;
}

@keyframes escoba-deck-deal {
  0% { transform: perspective(520px) rotateY(-10deg) rotateX(7deg) translateX(0); }
  45% { transform: perspective(520px) rotateY(-4deg) rotateX(3deg) translateX(18px) translateY(-8px); filter: brightness(1.18); }
  100% { transform: perspective(520px) rotateY(-10deg) rotateX(7deg) translateX(0); }
}

@media (max-width: 700px) {
  .escoba-table {
    grid-template-rows: 44px 64px minmax(230px, 1fr) 30px 116px 48px;
  }

  .escoba-table-cards {
    grid-template-columns: repeat(4, minmax(54px, 78px));
    grid-auto-rows: minmax(82px, 112px);
  }

  .escoba-card--table img {
    width: clamp(60px, 17vw, 78px);
  }

  .escoba-seat--human {
    transform: translateY(-34px);
    margin-bottom: -34px;
  }

    .escoba-seat span {
    font-size: 10px;
  }
}

@media (max-width: 420px) {
  .escoba-table-cards {
    grid-template-columns: repeat(2, minmax(62px, 82px));
    grid-auto-rows: 98px;
  }
}

/* Ajuste final ESCOBA: los montones capturados son pilas propias, no el mazo */
.escoba-seat--human .escoba-captured-pile {
  left: 14px;
  right: auto;
  top: auto;
  bottom: 112px;
  z-index: 18;
}

.escoba-seat--ai .escoba-captured-pile {
  left: auto;
  right: 14px;
  top: 70px;
  bottom: auto;
  z-index: 18;
}

.escoba-captured-pile {
  filter: drop-shadow(0 12px 14px rgba(0,0,0,.52));
}

.escoba-flying-card {
  z-index: 1200;
  box-shadow: 0 18px 28px rgba(0,0,0,.72), 0 0 18px rgba(255,222,103,.24);
}

.escoba-table.is-dealing .escoba-deck {
  filter: drop-shadow(0 0 18px rgba(255,219,91,.55));
}

@media (max-width: 700px) {
  .escoba-seat--human .escoba-captured-pile {
    left: 8px;
    right: auto;
    bottom: 104px;
  }

  .escoba-seat--ai .escoba-captured-pile {
    right: 8px;
    top: 58px;
  }
}
.escoba-captured-pile {
  display: grid;
  justify-items: center;
  gap: 4px;
  min-width: 82px;
}

.escoba-captured-stack {
  position: relative;
  width: 62px;
  height: 86px;
  transform-origin: center center;
}

.escoba-captured-back,
.escoba-captured-top {
  position: absolute;
  width: 54px;
  height: 78px;
  left: 4px;
  top: 4px;
  border-radius: 6px;
  object-fit: cover;
  box-shadow: 0 5px 8px rgba(0, 0, 0, 0.45);
}

.escoba-captured-back {
  object-fit: cover !important;
  transform:
    translate(
      calc(var(--pile-index) * 3px),
      calc(var(--pile-index) * -3px)
    )
    rotate(calc((var(--pile-index) - 3) * 1deg)) !important;
  opacity: 0.96 !important;
  z-index: calc(1 + var(--pile-index)) !important;
}
.escoba-captured-stack img {
  max-width: none !important;
  max-height: none !important;
}
.escoba-captured-top {
  z-index: 12;
  transform: translate(8px, -8px) rotate(2deg);
}

.escoba-captured-empty {
  position: absolute;
  inset: 10px;
  display: grid;
  place-items: center;
  border: 2px dashed rgba(255, 224, 138, 0.45);
  border-radius: 8px;
  color: #ffe08a;
  font-size: 18px;
  font-weight: 900;
  background: rgba(0, 0, 0, 0.28);
}

.escoba-mark {
  position: absolute;
  z-index: 20;
  width: 66px;
  height: 8px;
  left: -2px;
  top: calc(14px + var(--pile-index, 0) * 12px);
  border-radius: 999px;
  background: linear-gradient(90deg, #ffe08a, #b77a20);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.55);
  transform: rotate(-18deg);
}

.escoba-mark--0 { --pile-index: 0; }
.escoba-mark--1 { --pile-index: 1; }
.escoba-mark--2 { --pile-index: 2; }
.escoba-mark--3 { --pile-index: 3; }

.escoba-captured-meta {
  display: grid;
  justify-items: center;
  gap: 1px;
  color: #ffe08a;
  font-weight: 800;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.85);
}

.escoba-captured-meta strong {
  font-size: 13px;
}

.escoba-captured-meta span {
  font-size: 11px;
  color: #ffffff;
}

.escoba-captured-pile.is-receiving .escoba-captured-stack {
  animation: escobaPileReceive 520ms ease both;
}

.escoba-captured-pile.is-escoba .escoba-captured-stack {
  animation: escobaPileReceive 520ms ease both, escobaPileGlow 850ms ease both;
}

@keyframes escobaPileReceive {
  0% {
    transform: scale(1);
  }

  42% {
    transform: scale(1.16) rotate(-2deg);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes escobaPileGlow {
  0% {
    filter: drop-shadow(0 0 0 rgba(255, 224, 138, 0));
  }

  35% {
    filter: drop-shadow(0 0 18px rgba(255, 224, 138, 0.95));
  }

  100% {
    filter: drop-shadow(0 0 0 rgba(255, 224, 138, 0));
  }
}

@media (max-width: 700px) {
  .escoba-captured-stack {
    width: 54px;
    height: 74px;
  }

  .escoba-captured-back,
  .escoba-captured-top {
    width: 46px;
    height: 66px;
  }

  .escoba-mark {
    width: 56px;
    height: 7px;
  }

  .escoba-captured-meta strong {
    font-size: 11px;
  }

  .escoba-captured-meta span {
    font-size: 10px;
  }
}
.settings-tables {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.settings-table {
  position: relative;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
  aspect-ratio: 16 / 9;
}

.settings-table img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.settings-table.is-selected {
  border-color: #f4c760;
  box-shadow:
    0 0 0 2px rgba(244, 199, 96, 0.25),
    0 0 16px rgba(244, 199, 96, 0.5);
}

@media (max-width: 700px) {
  .settings-tables {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
