:root {
  --texas-gold: #ffc928;
  --texas-panel: #06101f;
}

.texas-page {
  min-height: 100vh;
  margin: 0;
  background: #02050b;
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
}

.texas-shell {
  width: min(100%, 1200px);
  margin: 0 auto;
  border: 2px solid var(--texas-gold);
  background: var(--texas-panel);
}

/* Intestazione */
.texas-shell > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 2px solid var(--texas-gold);
}

.texas-shell h1 {
  margin: 0;
  color: var(--texas-gold);
  font-size: clamp(20px, 2.5vw, 32px);
}

.texas-shell > header a {
  color: var(--texas-gold);
  font-weight: bold;
}

/* Pannello unico: crediti, nickname, posto */
.texas-player-panel {
  display: grid;
  grid-template-columns: 0.8fr 1fr 1.2fr;
  align-items: stretch;
  min-height: 42px;
  background: linear-gradient(180deg, #112137, #07101d);
  border-bottom: 2px solid var(--texas-gold);
}

.texas-player-panel > .texas-seat {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  box-sizing: border-box;
  margin: 0;
  padding: 6px 8px;
  border: 0;
  border-right: 1px solid rgba(255, 201, 40, 0.55);
  border-radius: 0;
  background: transparent;
  line-height: 1.15;
}

.texas-player-panel > .texas-seat:last-child {
  border-right: 0;
}

.texas-player-panel > form.texas-seat {
  flex-wrap: nowrap !important;
  gap: 4px !important;
}

.texas-player-panel #texas-credit {
  margin-left: 6px;
  font-size: 1.2em;
}

/* Tavolo e posti */
.texas-table {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #10271f url("/assets/texas/texas-table.png")
    center / cover no-repeat;
}

.texas-felt-brand { display: none; }
.texas-return-home { display: none; }

.texas-opponents {
  position: absolute;
  top: 7%;
  left: 12%;
  width: 76%;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.texas-seat {
  padding: 6px 10px;
  border: 1px solid var(--texas-gold);
  border-radius: 10px;
  background: rgba(6, 16, 31, 0.92);
  color: #fff;
  font-size: clamp(11px, 1.1vw, 15px);
  font-weight: bold;
  text-align: center;
}

/* Impostazioni compatte: la rotellina vive nell'area libera del tavolo. */
.texas-settings {
  position: absolute;
  right: 2.5%;
  bottom: 3.5%;
  z-index: 30;
}
.texas-settings-toggle {
  display: grid;
  place-items: center;
  width: clamp(42px, 4vw, 54px);
  aspect-ratio: 1;
  padding: 0;
  border: 2px solid var(--texas-gold);
  border-radius: 50%;
  background: linear-gradient(145deg, #18354a, #07121f);
  color: #ffd451;
  font-size: clamp(23px, 2.2vw, 31px);
  line-height: 1;
  cursor: pointer;
  box-shadow: inset 0 0 0 2px #ffffff12, 0 5px 15px #000b;
}
.texas-settings-toggle:hover,
.texas-settings-toggle:focus-visible,
.texas-settings--open .texas-settings-toggle {
  color: white;
  background: linear-gradient(145deg, #257f6c, #0a3d36);
  box-shadow: 0 0 18px rgba(255, 201, 40, .55), 0 5px 15px #000b;
}
.texas-settings-toggle:focus-visible { outline: 3px solid white; outline-offset: 2px; }
.texas-settings-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  box-sizing: border-box;
  width: min(350px, 72vw);
  padding: 12px;
  border: 1px solid var(--texas-gold);
  border-radius: 15px;
  background:
    radial-gradient(circle at 50% 0, rgba(29, 126, 101, .28), transparent 58%),
    linear-gradient(145deg, rgba(7, 20, 34, .98), rgba(12, 36, 48, .98));
  color: white;
  box-shadow: 0 14px 32px #000c;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px) scale(.97);
  transform-origin: bottom right;
  transition: opacity 150ms ease, transform 150ms ease, visibility 150ms;
}
.texas-settings--open .texas-settings-menu {
  opacity: 1;
  visibility: visible;
  transform: none;
}
.texas-format-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
}
.texas-format-heading strong {
  color: var(--texas-gold);
  font-size: 13px;
  letter-spacing: .06em;
}
.texas-format-heading span { color: #cae0ea; font-size: 10px; }
.texas-format-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}
.texas-format-card {
  position: relative;
  box-sizing: border-box;
  display: grid;
  min-height: 78px;
  padding: 7px;
  overflow: hidden;
  border: 2px solid rgba(255, 224, 138, .9);
  border-radius: 10px;
  color: white;
  cursor: pointer;
  isolation: isolate;
  box-shadow: inset 0 0 0 2px #ffffff18, 0 8px 18px #0008;
  transition: transform 160ms ease, filter 160ms ease, box-shadow 160ms ease;
}
.texas-format-card::after {
  content: "♠";
  position: absolute;
  right: 8px;
  bottom: -10px;
  z-index: -1;
  color: #ffffff1f;
  font-size: 48px;
  line-height: 1;
}
.texas-format-card > strong {
  font-size: 24px;
  line-height: .9;
}
.texas-format-card > span { font-size: 9px; font-weight: 900; }
.texas-format-card > small { color: #f7efd6; font-size: 8px; font-weight: 700; }
.texas-format-card--ruby { background: linear-gradient(145deg, #a92a45, #4b1024); }
.texas-format-card--amber { background: linear-gradient(145deg, #b87918, #49300a); }
.texas-format-card--emerald { background: linear-gradient(145deg, #168b70, #073d35); }
.texas-format-card--royal { background: linear-gradient(145deg, #335fbd, #172657); }
.texas-format-card:hover,
.texas-format-card:focus-visible {
  transform: translateY(-4px);
  filter: brightness(1.12);
  box-shadow: inset 0 0 0 2px #ffffff2b, 0 12px 25px #000b,
              0 0 18px rgba(255, 201, 40, .4);
}
.texas-format-card:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.texas-format-card--selected {
  box-shadow: inset 0 0 0 2px white, 0 0 16px rgba(255, 211, 76, .72);
}
@media (max-width: 900px) and (orientation: landscape) {
  .texas-settings { right: 1.2%; bottom: 2%; }
  .texas-settings-toggle { width: 34px; font-size: 20px; }
  .texas-settings-menu { width: 290px; padding: 8px; bottom: calc(100% + 6px); }
  .texas-format-heading { margin-bottom: 5px; }
  .texas-format-card { min-height: 58px; padding: 4px; border-radius: 8px; }
  .texas-format-card > strong { font-size: 19px; }
  .texas-format-card > span { font-size: 8px; }
  .texas-format-card > small { display: none; }
  .texas-format-card::after { font-size: 38px; }
}
@media (max-width: 520px) and (orientation: portrait) {
  .texas-settings { right: 10px; bottom: 10px; }
  .texas-settings-menu {
    position: fixed;
    right: 10px;
    bottom: 72px;
    left: 10px;
    width: auto;
    transform-origin: bottom center;
  }
  .texas-format-card { min-height: 72px; }
}
@media (prefers-reduced-motion: reduce) {
  .texas-format-card,
  .texas-settings-menu { transition: none; }
}

/* Cinque carte comuni */
.texas-board {
  position: absolute;
  top: 44%;
  left: 50%;
  display: flex;
  gap: clamp(4px, 0.8vw, 10px);
  transform: translate(-50%, -50%);
}

.texas-board span {
  width: clamp(32px, 5vw, 58px);
  aspect-ratio: 233 / 328;
  border: 2px solid var(--texas-gold);
  border-radius: 6px;
  background: rgba(6, 16, 31, 0.72);
}

/* Due carte personali */
.texas-player {
  position: absolute;
  bottom: 14%;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateX(-50%);
  white-space: nowrap;
  font-weight: bold;
}

.texas-player img {
  width: clamp(42px, 6vw, 72px);
  height: auto;
  -webkit-user-drag: none;
}

.texas-own-hand-label {
  position: absolute;
  bottom: 9.5%;
  left: 50%;
  z-index: 8;
  transform: translateX(-50%);
  max-width: 88%;
  padding: 4px 10px;
  border: 1px solid #ffe08a;
  border-radius: 9px;
  background: linear-gradient(180deg, rgba(10, 35, 47, .97), rgba(4, 17, 28, .97));
  color: #ffe47c;
  font-size: clamp(10px, .9vw, 13px);
  font-weight: 900;
  letter-spacing: .025em;
  text-align: center;
  white-space: nowrap;
  box-shadow: 0 4px 12px #000a, 0 0 12px rgba(255, 201, 40, .2);
  pointer-events: none;
}
.texas-own-hand-label[hidden] { display: none; }

/* Anteprima */
.texas-shell > p {
  margin: 0;
  padding: 12px 20px;
  border-top: 2px solid var(--texas-gold);
  text-align: center;
}

/* Evita la selezione accidentale delle carte */
.texas-table,
.texas-table * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* PC */
@media (min-width: 901px) {
  .texas-page {
    background-image: url("/assets/texas/cards/texas-desktop-bg.png");
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    background-attachment: fixed;
  }

  /* PC compatto: il titolo superiore sparisce e i dati scendono ai comandi. */
  .texas-shell {
    width: min(100%, calc((100dvh - 112px) * 1.78), 1560px);
  }

  .texas-shell > header {
    display: none;
  }

  .texas-player-panel--desktop-bottom {
    min-height: 38px;
    border-top: 1px solid var(--texas-gold);
    border-bottom: 1px solid var(--texas-gold);
  }

  .texas-table {
    height: clamp(430px, calc(100dvh - 112px), 850px);
    min-height: 0;
    aspect-ratio: auto;
    overflow: hidden;
    background-size: 145% auto;
    background-position: center 42%;
  }

  /* Filigrana impressa esclusivamente nel feltro verde. */
  .texas-felt-brand {
    position: absolute;
    top: 59%;
    left: 50%;
    z-index: 0;
    display: flex;
    align-items: center;
    transform: translate(-50%, -50%);
    max-width: 62%;
    color: rgba(224, 255, 247, .16);
    font-size: clamp(28px, 3.5vw, 52px);
    font-weight: 1000;
    letter-spacing: -.055em;
    line-height: 1;
    white-space: nowrap;
    text-shadow: 0 2px 0 rgba(235, 255, 250, .12),
                 0 -2px 0 rgba(0, 43, 35, .28);
    pointer-events: none;
  }

  .texas-felt-brand span {
    margin-right: .08em;
    font-size: .72em;
  }

  /* Ritorno sempre visibile sul desktop, senza ripristinare la testata alta. */
  .texas-return-home {
    position: absolute;
    top: 2.2%;
    left: 1.8%;
    z-index: 31;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 7px 13px;
    border: 2px solid var(--texas-gold);
    border-radius: 10px;
    background: linear-gradient(145deg, rgba(5, 42, 37, .96), rgba(2, 17, 27, .98));
    color: #fff;
    font-size: clamp(11px, .9vw, 14px);
    font-weight: 900;
    letter-spacing: .04em;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .42), inset 0 0 0 1px rgba(255, 255, 255, .08);
  }

  .texas-return-home:hover,
  .texas-return-home:focus-visible {
    color: #07131b;
    background: linear-gradient(145deg, #ffe36a, var(--texas-gold));
    outline: none;
    transform: translateY(-1px);
  }

  /* Nomi sul pavimento, appena fuori dal tavolo */
  .texas-opponents {
    top: 1%;
    left: 14%;
    width: 72%;
  }

  /* Cinque carte comuni al centro del tavolo */
  .texas-board {
    top: 42%;
  }

  .texas-board span {
    width: clamp(60px, 6.4vw, 82px);
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.45);
  }

  /* Carte personali vicino al proprio posto */
  .texas-player {
    bottom: 14%;
  }

  .texas-player img {
    filter: drop-shadow(0 7px 9px rgba(0, 0, 0, 0.55));
  }
}

/* Footer PC: quattro elementi nella riga inferiore */
@media (min-width: 900px) and (hover: hover) and (pointer: fine) {
  .texas-shell .desktop-game-footer-responsible {
    grid-template-columns: auto minmax(190px, 1fr) auto auto;
  }
}

/* Schermi piccoli */
@media (max-width: 700px) {
  .texas-shell {
    border-width: 1px;
  }

  .texas-shell > header {
    flex-wrap: wrap;
    padding: 12px;
  }

  .texas-table {
    aspect-ratio: auto;
    min-height: 70svh;
  }

  .texas-opponents {
    left: 3%;
    width: 94%;
  }

  .texas-seat {
    padding: 5px;
    font-size: 10px;
  }

  .texas-board span {
    width: min(12vw, 46px);
  }

  .texas-player {
    bottom: 8%;
    gap: 6px;
    font-size: 12px;
  }

  .texas-player img {
    width: min(16vw, 58px);
  }
}

/* Telefono in verticale */
@media (max-width: 900px) and (orientation: portrait) {
  .texas-page::before {
    content: "Ruota il telefono in orizzontale per vedere il tavolo Texas";
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    padding: 24px;
    background: #06101f;
    color: var(--texas-gold);
    font-size: 22px;
    font-weight: bold;
    line-height: 1.4;
    text-align: center;
  }
}

/* Telefono in orizzontale */
@media (max-width: 900px) and (orientation: landscape) {
  .texas-page {
    height: 100dvh;
    overflow: hidden;
  }

  .texas-shell {
    box-sizing: border-box;
    width: 100vw;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .texas-shell > header {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    padding: 6px 12px;
  }

  .texas-shell h1 {
    font-size: clamp(14px, 2.5vw, 20px);
  }

  .texas-player-panel {
    flex: 0 0 auto;
    min-height: 30px;
  }

  .texas-player-panel > .texas-seat {
    padding: 3px 5px;
    font-size: 10px;
  }

  .texas-table {
    flex: 1 1 auto;
    min-height: 0;
    aspect-ratio: auto;
  }

  .texas-opponents {
    top: 7%;
  }

  .texas-player {
    bottom: 4%;
  }

  .texas-shell > p {
    flex: 0 0 auto;
    padding: 4px;
    font-size: 11px;
  }
}


/* Posti del tavolo: avatar, nome e indicazione dei giocatori automatici. */
.texas-opponents .texas-roster-seat {
  position: absolute;
  z-index: 2;
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 2px;
  width: clamp(78px, 11vw, 134px);
  max-width: 19%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}

/* Bandiera decorativa dei bot: solo desktop, sopra il giocatore. */
.texas-roster-country {
  position: absolute;
  top: -25px;
  left: 50%;
  z-index: 8;
  display: grid;
  place-items: center;
  min-width: 27px;
  height: 20px;
  padding: 0 4px;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 216, 83, .9);
  border-radius: 5px;
  background: rgba(6, 16, 31, .94);
  box-shadow: 0 3px 8px rgba(0, 0, 0, .65);
  font-family: "Segoe UI Emoji", "Apple Color Emoji", sans-serif;
  font-size: 18px;
  line-height: 1;
  pointer-events: none;
}

@media (max-width: 900px) {
  .texas-roster-country {
    display: none !important;
  }
}

.texas-roster-avatar {
  box-sizing: border-box;
  display: grid;
  place-items: center;
  width: clamp(32px, 4.2vw, 52px);
  height: clamp(32px, 4.2vw, 52px);
  flex: none;
  border: 2px solid var(--texas-gold);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 25%,
    hsl(var(--avatar-hue) 64% 55%),
    hsl(var(--avatar-hue) 48% 21%));
  box-shadow: 0 3px 10px rgba(0, 0, 0, .6);
  color: white;
  font-size: clamp(12px, 1.5vw, 18px);
  font-weight: 800;
}

.texas-roster-avatar-image {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  -webkit-user-drag: none;
  filter: saturate(1.06) contrast(1.03);
}

.texas-roster-name {
  box-sizing: border-box;
  max-width: 100%;
  overflow: hidden;
  padding: 3px 7px;
  border: 1px solid var(--texas-gold);
  border-radius: 9px;
  background: rgba(6, 16, 31, .96);
  color: white;
  font-size: clamp(9px, .9vw, 13px);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.texas-roster-badge {
  padding: 1px 4px;
  border-radius: 4px;
  background: #172737;
  color: #f9d977;
  font-size: clamp(8px, .7vw, 10px);
  font-weight: 700;
}

.texas-roster-seat--empty .texas-roster-avatar {
  border-style: dashed;
  background: rgba(6, 16, 31, .65);
}

.texas-opponents .texas-roster-bank {
  position: absolute;
  z-index: 2;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

@media (max-width: 900px) and (orientation: landscape) {
  .texas-opponents .texas-roster-seat {
    gap: 0;
    width: 11%;
    max-width: none;
  }

  .texas-roster-avatar {
    width: clamp(24px, 5.5vh, 34px);
    height: clamp(24px, 5.5vh, 34px);
    border-width: 1px;
    font-size: 11px;
  }

  .texas-roster-name {
    max-width: 100%;
    padding: 1px 3px;
    font-size: clamp(7px, 1.7vh, 10px);
  }

  .texas-roster-badge {
    padding: 0 2px;
    font-size: 7px;
  }
}

/* Sul telefono la grafica lascia spazio ai posti e alle carte personali. */
@media (max-width: 900px) and (orientation: landscape) {
  .texas-table {
    background-size: 122% auto;
    background-position: center 42%;
  }

  .texas-player {
    bottom: 15%;
  }

  .texas-opponents .texas-roster-seat[aria-label^="Il tuo posto"] {
    top: 90% !important;
  }
}

/* Due dorsi delle carte solo per gli avversari seduti. */
.texas-roster-portrait {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.texas-roster-cards {
  display: inline-flex;
  align-items: center;
  padding: 0 2px;
}

.texas-roster-cards img {
  display: block;
  width: clamp(16px, 1.75vw, 22px);
  height: auto;
  margin-left: -4px;
  border: 1px solid #fff;
  border-radius: 2px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .65);
  -webkit-user-drag: none;
  pointer-events: none;
}

@media (max-width: 900px) and (orientation: landscape) {
  .texas-roster-portrait {
    gap: 1px;
  }

  .texas-roster-cards img {
    width: clamp(11px, 2.4vh, 15px);
    margin-left: -3px;
  }
}

/* Comando di distribuzione: usa il mazzo del server, senza toccare i crediti. */
.texas-hand-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 48px;
  padding: 6px 10px;
  border-top: 1px solid var(--texas-gold);
  background: #091728;
  font-size: 13px;
}

.texas-hand-controls button {
  padding: 8px 15px;
  border: 2px solid #ffdf69;
  border-radius: 9px;
  background: linear-gradient(#1bac59, #076c37);
  box-shadow: 0 3px 0 #043920;
  color: white;
  font-weight: 800;
  cursor: pointer;
}

.texas-hand-controls button:disabled {
  opacity: .58;
  cursor: default;
}

@media (max-width: 900px) and (orientation: landscape) {
  .texas-hand-controls {
    flex: 0 0 auto;
    min-height: 0;
    padding: 2px 6px;
    font-size: 10px;
  }

  .texas-hand-controls button {
    padding: 3px 8px;
    font-size: 10px;
  }
}

/* Saldi del wallet condiviso nello stesso riquadro, anche in orizzontale. */
.texas-player-panel > .texas-seat:has(#texas-credit) {
  gap: clamp(8px, 1.4vw, 20px);
  flex-wrap: wrap;
}

.texas-wallet-value {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  white-space: nowrap;
}

.texas-player-panel .texas-wallet-value output {
  margin-left: 0;
  font-size: 1.12em;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 900px) and (orientation: landscape) {
  .texas-player-panel {
    grid-template-columns: 1.15fr 1fr 1.2fr;
  }
  .texas-player-panel > .texas-seat:has(#texas-credit) {
    gap: 6px;
    padding: 3px;
  }
  .texas-wallet-value {
    gap: 3px;
  }
}

/* Separazione visiva tra le etichette e i due saldi. */
.texas-player-panel > .texas-seat:has(#texas-credit) {
  gap: 0;
  flex-wrap: nowrap;
  padding: 0 6px;
}

.texas-wallet-value {
  gap: 0;
  min-width: 0;
  padding: 0 8px;
  color: #ffe08a;
}

.texas-wallet-value + .texas-wallet-value {
  border-left: 1px solid rgba(255, 201, 40, .65);
  color: #9ee8dc;
}

.texas-player-panel .texas-wallet-value output {
  margin-left: 6px;
  padding-left: 6px;
  border-left: 1px solid currentColor;
  color: #ffcf43;
  font-weight: 800;
}

.texas-player-panel #texas-points {
  color: #6af0d7;
}

@media (max-width: 900px) and (orientation: landscape) {
  .texas-player-panel > .texas-seat:has(#texas-credit) {
    gap: 0;
    padding: 0 2px;
  }
  .texas-wallet-value {
    padding: 0 4px;
  }
  .texas-player-panel .texas-wallet-value output {
    margin-left: 3px;
    padding-left: 3px;
  }
}

/* Stessi divisori usati nei saldi per nickname e posto. */
.texas-player-panel > form.texas-seat > span[role="status"],
.texas-player-panel > #texas-table-status {
  gap: 0 !important;
  white-space: nowrap;
}

.texas-panel-label {
  color: #ffe08a;
}

.texas-panel-value {
  margin-left: 7px;
  padding-left: 7px;
  border-left: 1px solid var(--texas-gold);
  color: #fff;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 900px) and (orientation: landscape) {
  .texas-panel-value {
    margin-left: 4px;
    padding-left: 4px;
  }
}

/* Telefono in orizzontale: il tavolo resta circondato dal pavimento. */
@media (max-width: 900px) and (orientation: landscape) {
  .texas-table {
    background-color: #292728;
    background-size: 82% auto;
    background-position: center center;
  }

  .texas-hand-controls {
    flex-wrap: nowrap;
  }

  .texas-hand-controls button {
    min-height: 30px;
    white-space: nowrap;
  }
}

/* Il turno è segnalato direttamente sul posto che sta agendo. */
.texas-roster-seat--turn .texas-roster-avatar,
.texas-roster-seat--turn .texas-roster-name {
  border-color: #fff29b;
  box-shadow: 0 0 0 3px rgba(255, 201, 40, .8),
              0 0 20px 7px rgba(255, 201, 40, .72);
  animation: texas-turn-glow 1.2s ease-in-out infinite alternate;
}
@keyframes texas-turn-glow {
  from { filter: brightness(1); }
  to { filter: brightness(1.6); }
}
@media (prefers-reduced-motion: reduce) {
  .texas-roster-seat--turn .texas-roster-avatar,
  .texas-roster-seat--turn .texas-roster-name { animation: none; }
}

/* Nel Texas il dealer ha il bottone D; il piatto resta al centro. */
.texas-roster-pot {
  color: var(--texas-gold);
  box-shadow: 0 0 12px rgba(255, 201, 40, .45);
}

.texas-dealer-button {
  position: absolute;
  top: 2px;
  right: auto;
  left: calc(100% + 4px);
  display: grid;
  place-items: center;
  width: clamp(18px, 2.1vw, 27px);
  aspect-ratio: 1;
  border: 2px solid #d9ad29;
  border-radius: 50%;
  background: #fff;
  color: #091523;
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 2px 5px #0009;
}

/* Il dealer resta fuori dalle carte; vicino al bordo destro rientra a sinistra. */
.texas-roster-seat--right-edge .texas-dealer-button {
  right: calc(100% + 4px);
  left: auto;
}

.texas-action-bubble {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  z-index: 3;
  transform: translateX(-50%);
  padding: 4px 8px;
  border: 1px solid #ffe08a;
  border-radius: 10px;
  background: #f8f0ce;
  color: #10202d;
  font-size: clamp(10px, .9vw, 13px);
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 3px 10px #0009;
}

@media (max-width: 900px) and (orientation: landscape) {
  .texas-dealer-button {
    width: 18px;
    left: calc(100% + 2px);
    font-size: 10px;
  }
  .texas-roster-seat--right-edge .texas-dealer-button {
    right: calc(100% + 2px);
    left: auto;
  }
  .texas-action-bubble {
    padding: 2px 4px;
    font-size: 9px;
  }
}

/* Il server individua i vincitori anche quando sono bot. */
.texas-roster-seat--winner .texas-roster-avatar,
.texas-roster-seat--winner .texas-roster-name {
  border-color: #7cf4a3;
  box-shadow: 0 0 0 3px rgba(74, 230, 125, .7),
              0 0 20px 5px rgba(74, 230, 125, .6);
}

/* Presenze effettive Texas accanto al nickname. */
.texas-online-count {
  display: inline-flex;
  align-items: center;
  padding-left: 8px;
  margin-left: 8px;
  border-left: 1px solid rgba(255, 201, 40, .65);
  white-space: nowrap;
}
.texas-online-count .texas-panel-label { color: #9ee8dc; }
.texas-online-count .texas-panel-value {
  color: #6af0d7;
  border-left-color: #6af0d7;
}
@media (max-width: 900px) and (orientation: landscape) {
  .texas-online-count {
    padding-left: 4px;
    margin-left: 4px;
  }
}

/* Timer condiviso del turno reale e simbolo dei posti automatici. */
.texas-roster-avatar { position: relative; }
.texas-roster-automated {
  position: absolute;
  right: -6px;
  bottom: -5px;
  display: grid;
  place-items: center;
  width: 15px;
  height: 15px;
  border: 1px solid var(--texas-gold);
  border-radius: 50%;
  background: #0b1828;
  color: var(--texas-gold);
  font-size: 10px;
}
.texas-turn-clock {
  position: absolute;
  top: calc(100% + 3px);
  right: -2px;
  z-index: 4;
  min-width: 24px;
  padding: 2px 5px;
  border: 1px solid #ffde66;
  border-radius: 8px;
  background: #0d2030;
  color: #ffde66;
  font-size: clamp(10px, 1vw, 13px);
  font-weight: 800;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.texas-turn-clock--urgent {
  border-color: #ff5757;
  color: #ff5757;
}

/* La scelta del posto è disponibile anche con il tocco sul telefono. */
.texas-opponents .texas-roster-seat--empty,
.texas-opponents .texas-roster-seat--bot {
  pointer-events: auto;
}
.texas-sit-button {
  padding: 4px 8px;
  border: 1px solid #ffcf43;
  border-radius: 8px;
  background: #12482f;
  color: #fff;
  font: 800 clamp(10px, .95vw, 13px) Arial, sans-serif;
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
}
.texas-sit-button:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}
.texas-roster-seat--folded .texas-roster-cards {
  opacity: .28;
}
@media (max-width: 900px) and (orientation: landscape) {
  .texas-sit-button { padding: 2px 3px; font-size: 9px; }
}

/* Allo showdown sono leggibili entrambe le carte di ciascun avversario. */
.texas-roster-seat--revealed { z-index: 5 !important; }
.texas-roster-seat--revealed .texas-roster-cards img {
  width: clamp(36px, 3vw, 45px);
  margin-left: -3px;
  border-width: 2px;
  border-radius: 4px;
  box-shadow: 0 5px 12px #000c;
}
.texas-roster-seat--revealed .texas-roster-portrait {
  background: #071522c9;
  border-radius: 6px;
}
@media (max-width: 900px) and (orientation: landscape) {
  .texas-roster-seat--revealed .texas-roster-cards img {
    width: clamp(19px, 3.3vh, 28px);
    margin-left: -4px;
    border-width: 1px;
  }
  .texas-roster-seat--revealed .texas-roster-avatar {
    width: clamp(20px, 4vh, 28px);
    height: clamp(20px, 4vh, 28px);
  }
}

/* Azioni della mano di prova. CALL e RAISE attendono puntate sul server. */
.texas-hand-controls .texas-action-fold {
  background: linear-gradient(#a93f3f, #721b27);
  box-shadow: 0 3px 0 #3c121a;
}
.texas-hand-controls button:disabled {
  opacity: .45;
  filter: grayscale(.5);
}
.texas-raise-preview {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #f7d983;
  font-weight: 800;
  white-space: nowrap;
}
.texas-raise-preview input { width: clamp(75px, 9vw, 125px); accent-color: #17af83; }
.texas-raise-preview output { min-width: 22px; color: white; text-align: right; }
.texas-chip-preview {
  position: absolute;
  left: 54%;
  top: 62%;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 5px;
  border-radius: 8px;
  background: #071522a8;
  pointer-events: none;
  --chip: #e9e9d7;
  --chip-edge: #a8a99e;
}
.texas-chip-preview--red { --chip: #dc3d43; --chip-edge: #7c1e26; }
.texas-chip-preview--blue { --chip: #318eda; --chip-edge: #195080; }
.texas-chip-preview--gold { --chip: #e5b326; --chip-edge: #846414; }
.texas-chip-disc {
  display: grid;
  place-items: center;
  box-sizing: border-box;
  width: 27px;
  height: 27px;
  color: #172131;
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px #fff8;
  border: 3px dashed #fff;
  border-radius: 50%;
  background: var(--chip);
  box-shadow: 0 3px 0 var(--chip-edge), 0 6px 0 var(--chip),
    0 9px 0 var(--chip-edge), 0 12px 9px #0009;
}
.texas-chip-caption {
  color: #fff;
  font-size: clamp(8px, .72vw, 10px);
  font-weight: 800;
  white-space: nowrap;
}
@media (max-width: 900px) and (orientation: landscape) {
  .texas-hand-controls {
    justify-content: flex-start;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: thin;
  }
  .texas-hand-controls button { flex: none; }
  .texas-raise-preview { flex: none; font-size: 9px; }
  .texas-raise-preview input { width: 65px; }
  .texas-chip-preview { top: 62%; left: 55%; padding: 1px 2px; }
  .texas-chip-disc { width: 19px; height: 19px; border-width: 2px; font-size: 11px; }
  .texas-chip-caption { font-size: 7px; }
}

/* Anche i dorsi restano distinguibili prima dello showdown. */
.texas-roster-cards img { width: clamp(26px, 2.4vw, 34px); }
@media (max-width: 900px) and (orientation: landscape) {
  .texas-roster-cards img { width: clamp(16px, 2.8vh, 22px); }
}

/* Barra azioni Texas: comandi raccolti come nel riferimento del kit. */
.texas-shell .texas-action-bar {
  gap: 5px;
  min-height: 58px;
  padding: 7px 10px;
  border-top: 1px solid #ba9a5c;
  background:
    repeating-linear-gradient(125deg, #ffffff09 0 1px, transparent 1px 18px),
    linear-gradient(180deg, #36393f 0%, #1a1e24 50%, #090d13 100%);
  box-shadow: inset 0 2px 5px #ffffff25, inset 0 -3px 6px #000a;
}
.texas-action-bar .texas-action-key {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 68px;
  min-height: 45px;
  padding: 3px 7px;
  border: 1px solid #777e85;
  border-radius: 7px;
  background: linear-gradient(#545b61, #2a2f35 55%, #1b2026);
  box-shadow: inset 0 1px 1px #fffc, 0 2px 3px #000b;
  color: #f7f8f9;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}
.texas-action-bar .texas-action-key::before {
  display: block;
  margin-bottom: 2px;
  color: #55dcc1;
  font-size: 19px;
  line-height: 1;
}
.texas-action-bar .texas-action-fold,
.texas-action-bar .texas-action-check,
.texas-action-bar .texas-action-call,
.texas-action-bar .texas-action-raise,
.texas-action-bar .texas-action-allin {
  background: linear-gradient(#545b61, #2a2f35 55%, #1b2026);
  box-shadow: inset 0 1px 1px #fffc, 0 2px 3px #000b;
}
.texas-action-bar .texas-action-allin:not(:disabled) {
  border-color: #ffd64f;
  background: linear-gradient(#b62936, #741622 58%, #3f0b12);
  color: #fff8d5;
  box-shadow: inset 0 1px 1px #fff8, 0 0 8px #ffbd3859;
}
.texas-action-bar .texas-action-fold::before { content: "×"; }
.texas-action-bar .texas-action-check::before { content: "✓"; }
.texas-action-bar .texas-action-call::before { content: "✓"; }
.texas-action-bar .texas-action-raise::before { content: "⇧"; }
.texas-action-bar .texas-action-allin::before {
  content: "★";
  color: #ffd64f;
}
.texas-action-bar .texas-action-key:disabled { opacity: .52; cursor: default; }
.texas-action-bar .texas-raise-preview {
  gap: 6px;
  padding: 4px 8px;
  border: 1px solid #55616b;
  border-radius: 7px;
  background: #151b20;
  color: #f3d287;
  font-size: 10px;
}
.texas-action-bar .texas-stake-step {
  flex: none;
  width: 27px;
  height: 28px;
  min-height: 0;
  padding: 0;
  border: 1px solid #70777b;
  border-radius: 5px;
  background: #353d42;
  color: #fff;
  font-size: 18px;
  line-height: 1;
}
.texas-action-bar .texas-raise-preview input {
  width: clamp(72px, 8vw, 125px);
  accent-color: #169579;
}
.texas-action-bar .texas-raise-preview output {
  min-width: 43px;
  font-size: 14px;
  color: #66e3ca;
  font-variant-numeric: tabular-nums;
}
.texas-action-bar > span[role="status"] {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #fff;
  font-size: 11px;
}
.texas-chip-preview--purple { --chip: #854bc8; --chip-edge: #492380; }
.texas-chip-preview--blue .texas-chip-disc,
.texas-chip-preview--purple .texas-chip-disc { color: #fff8de; text-shadow: 0 1px #0009; }
.texas-win-bubble {
  z-index: 10;
  border-color: #fff5a6;
  background: #f5d457;
  color: #15150b;
  font-size: clamp(10px, .95vw, 14px);
  animation: texas-win-pop .55s ease-out both;
}
.texas-roster-seat--upper .texas-win-bubble {
  top: calc(100% + 4px);
  bottom: auto;
}
.texas-roster-seat--left-edge .texas-win-bubble {
  left: 0;
  transform: none;
}
.texas-roster-seat--right-edge .texas-win-bubble {
  right: 0;
  left: auto;
  transform: none;
}
@keyframes texas-win-pop {
  from { opacity: 0; transform: translate(-50%, 10px) scale(.5); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
.texas-roster-seat--left-edge .texas-win-bubble,
.texas-roster-seat--right-edge .texas-win-bubble {
  animation-name: texas-win-pop-edge;
}
@keyframes texas-win-pop-edge {
  from { opacity: 0; transform: translateY(10px) scale(.5); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .texas-win-bubble { animation: none; }
}
@media (max-width: 900px) and (orientation: landscape) {
  .texas-shell .texas-action-bar {
    min-height: 0;
    padding: 3px 6px;
    gap: 3px;
  }
  .texas-action-bar .texas-action-key {
    min-width: 50px;
    min-height: 32px;
    padding: 2px 4px;
    font-size: 9px;
  }
  .texas-action-bar .texas-action-key::before { font-size: 13px; margin-bottom: 1px; }
  .texas-action-bar .texas-raise-preview { padding: 2px; font-size: 8px; }
  .texas-action-bar .texas-stake-step { width: 22px; height: 23px; font-size: 15px; }
  .texas-action-bar .texas-raise-preview input { width: 55px; }
  .texas-action-bar .texas-raise-preview output { min-width: 30px; font-size: 10px; }
  .texas-action-bar > span[role="status"] { font-size: 9px; }
  .texas-win-bubble { font-size: 9px; }
}

/* Dimensioni costanti: il polling della mano non sposta i comandi. */
@media (min-width: 901px) {
  .texas-shell .texas-action-bar {
    display: grid;
    grid-template-columns: 70px 190px 70px 84px 325px minmax(0, 1fr);
    justify-content: stretch;
    align-items: center;
  }
  .texas-action-bar .texas-action-key {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }
  .texas-action-bar .texas-raise-preview {
    box-sizing: border-box;
    width: 100%;
    justify-content: center;
  }
  .texas-action-bar > span[role="status"] {
    display: block;
    width: 100%;
  }
}
@media (max-width: 900px) {
  .texas-shell .texas-action-bar {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    justify-content: start;
    overflow-x: auto;
  }
  .texas-action-bar .texas-action-check { width: 160px; }
  .texas-action-bar > span[role="status"] {
    width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* Fiches mostrate soltanto quando esiste una puntata server nel giro. */
.texas-pending-note {
  box-sizing: border-box;
  width: clamp(130px, 18vw, 220px);
  padding: 4px 7px;
  border: 1px solid var(--texas-gold);
  border-radius: 9px;
  background: #0c1b2bee;
  color: #ffdf83;
  font-size: clamp(9px, .9vw, 12px);
  font-weight: 800;
  line-height: 1.2;
  white-space: normal;
  text-align: center;
}
@media (max-width: 900px) and (orientation: landscape) {
  .texas-pending-note { width: min(28vw, 150px); font-size: 9px; padding: 2px 4px; }
}

.texas-roster-bet {
  position: absolute;
  z-index: 8;
  top: calc(100% + 5px);
  left: 50%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 5px 7px;
  border: 1px solid #e4c568;
  border-radius: 8px;
  background: #091c29ed;
  color: #fff;
  font-size: clamp(9px, .85vw, 12px);
  font-weight: 900;
  white-space: nowrap;
  transform: translateX(-50%);
  pointer-events: none;
  font-variant-numeric: tabular-nums;
  --bet-chip: #f2f2ec;
  --bet-edge: #abb3ae;
}
.texas-roster-seat--lower .texas-roster-bet {
  top: auto;
  bottom: calc(100% + 7px);
}

/* La puntata del giocatore reale resta laterale: non copre mai le carte personali. */
.texas-roster-seat[data-seat-kind="own"] .texas-roster-bet {
  top: 50%;
  bottom: auto;
  left: calc(100% + 7px);
  transform: translateY(-50%);
}

@media (max-width: 900px) and (orientation: landscape) {
  .texas-roster-seat[data-seat-kind="own"] .texas-roster-bet {
    top: 42%;
    left: calc(100% + 3px);
    padding: 1px 3px 5px;
  }
}
.texas-roster-bet--red { --bet-chip: #e5434c; --bet-edge: #81262f; }
.texas-roster-bet--blue { --bet-chip: #308fe0; --bet-edge: #1c5386; }
.texas-roster-bet--gold { --bet-chip: #ecc232; --bet-edge: #927021; }
.texas-roster-bet--purple { --bet-chip: #9051ce; --bet-edge: #502b78; }
.texas-roster-bet-disc {
  display: grid;
  place-items: center;
  box-sizing: border-box;
  width: 22px;
  height: 22px;
  border: 3px dashed #fff;
  border-radius: 50%;
  background: var(--bet-chip);
  color: #142132;
  text-shadow: 0 1px #fff9;
  box-shadow: 0 3px var(--bet-edge), 0 6px var(--bet-chip),
    0 9px var(--bet-edge), 0 11px 8px #0009;
}
.texas-roster-bet--blue .texas-roster-bet-disc,
.texas-roster-bet--purple .texas-roster-bet-disc {
  color: #fff4cd;
  text-shadow: 0 1px #0009;
}
@media (max-width: 900px) and (orientation: landscape) {
  .texas-roster-bet { gap: 3px; padding: 1px 3px 5px; font-size: 9px; }
  .texas-roster-bet-disc { width: 16px; height: 16px; border-width: 2px; font-size: 10px; }
}

.texas-roster-stack {
  display: block;
  padding: 1px 4px;
  border: 1px solid #b99b56;
  border-radius: 6px;
  background: #0d2332;
  color: #f6df91;
  font-size: clamp(8px, .75vw, 10px);
  font-weight: 800;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 900px) and (orientation: landscape) {
  .texas-roster-stack {
    padding: 0 2px;
    font-size: clamp(7px, 1.4vh, 9px);
  }
}

/* Barra del tavolo centrata: stessi gruppi di comandi su PC e telefono. */
.texas-shell .texas-action-bar {
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  overflow: visible;
  width: 100%;
  gap: 5px 7px;
}
.texas-action-bar .texas-action-key { width: auto; }
.texas-action-bar .texas-action-check { width: auto; }
.texas-action-bar .texas-raise-preview {
  box-sizing: border-box;
  width: auto;
  max-width: 100%;
  flex: 0 1 auto;
  justify-content: center;
}
.texas-action-bar > span[role="status"] {
  box-sizing: border-box;
  flex: 0 0 100%;
  width: 100%;
  min-height: 12px;
  text-align: center;
}
@media (max-width: 900px) {
  .texas-shell .texas-action-bar {
    display: flex;
    justify-content: center;
    overflow: visible;
    white-space: normal;
  }
  .texas-action-bar .texas-action-check { width: auto; }
  .texas-action-bar .texas-raise-preview input { width: clamp(45px, 12vw, 90px); }
  .texas-action-bar > span[role="status"] { width: 100%; }
}

/* Dorsi che partono dal mazzo e raggiungono i posti, in ordine. */
.texas-deal-flight {
  position: fixed;
  z-index: 2147483000;
  display: block;
  box-sizing: border-box;
  border: 1px solid #ffe5a2;
  border-radius: 4px;
  background: #0b1b2b;
  box-shadow: 0 5px 12px #000a;
  pointer-events: none;
  user-select: none;
}

/* Distribuzione: le carte arrivano una volta per mano, senza ripetere al polling. */
.texas-card-deal {
  animation: texas-deal-card 620ms cubic-bezier(.14,.75,.28,1.12) both;
  animation-delay: var(--texas-deal-delay, 0ms);
  transform-origin: 50% 100%;
}
@keyframes texas-deal-card {
  0% { opacity: 0; transform: translate(0, -38px) rotate(-20deg) scale(.6); }
  68% { opacity: 1; transform: translate(0, 5px) rotate(2deg) scale(1.05); }
  100% { opacity: 1; transform: translate(0, 0) rotate(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .texas-card-deal { animation: none; }
}

/* Telefono orizzontale: comandi visibili e tavolo separato dalla barra. */
@media (max-width: 900px) and (orientation: landscape) {
  .texas-shell > header {
    padding: 3px 8px;
    gap: 8px;
  }
  .texas-shell h1 { font-size: clamp(12px, 2.2vw, 18px); }
  .texas-player-panel { min-height: 26px; }
  .texas-player-panel > .texas-seat { padding: 2px 3px; }
  .texas-table {
    flex: 1 1 0;
    min-height: 0;
    /* L'immagine originale riempie il telefono senza stirare l'ovale. */
    background-image: url("/assets/texas/texas-table.png"),
      url("/assets/texas/texas-table.png");
    background-size: 92% auto, cover;
    background-position: center 35%, center 44%;
    background-repeat: no-repeat;
  }
  .texas-board { top: 45%; }
  .texas-board span { width: clamp(24px, 6.2vh, 44px); }
  .texas-player { bottom: 11%; gap: 4px; }
  .texas-player img { width: clamp(28px, 8vh, 54px); }
  .texas-own-hand-label {
    bottom: 7%;
    padding: 2px 6px;
    font-size: clamp(8px, 1.5vh, 10px);
  }
  .texas-shell .texas-action-bar {
    flex: 0 0 auto;
    max-height: 28vh;
    overflow-y: auto;
    margin-top: 3px;
    padding: 3px 4px;
    gap: 3px;
  }
  .texas-shell > p { padding: 2px; font-size: 9px; }
}
.texas-join-queue {
  flex: 0 0 auto;
  padding: 6px 10px;
  border: 1px solid var(--texas-gold);
  border-radius: 7px;
  background: #15593d;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}
.texas-join-queue:focus-visible { outline: 2px solid #fff; }
.texas-join-queue.texas-join-queue--disabled,
.texas-join-queue.texas-join-queue--disabled:disabled {
  border-color: #ff8b8b;
  background: linear-gradient(#c8323e, #821923);
  color: #fff;
  opacity: 1;
  cursor: not-allowed;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12),
              0 0 10px rgba(220, 36, 50, .28);
}
@media (max-width: 900px) and (orientation: landscape) {
  .texas-join-queue { padding: 3px 5px; font-size: 9px; }
}

@media (max-width: 900px) and (orientation: landscape) {
  .texas-opponents .texas-roster-seat {
    width: clamp(70px, 7.6vw, 112px);
    max-width: none;
  }
  .texas-roster-name,
  .texas-roster-stack {
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .texas-roster-stack {
    font-size: clamp(7px, 1.35vh, 9px);
    letter-spacing: -.02em;
  }
  .texas-roster-cards img { width: clamp(12px, 2.5vh, 18px); }
}

/* I messaggi azione restano fuori da avatar e carte personali. */
.texas-roster-seat .texas-action-bubble:not(.texas-win-bubble) {
  top: auto;
  bottom: calc(100% + 6px);
  z-index: 9;
}
.texas-roster-seat--upper .texas-action-bubble:not(.texas-win-bubble) {
  top: calc(100% + 6px);
  bottom: auto;
}
.texas-roster-seat--left-edge .texas-action-bubble:not(.texas-win-bubble) {
  left: 0;
  transform: none;
}
.texas-roster-seat--right-edge .texas-action-bubble:not(.texas-win-bubble) {
  right: 0;
  left: auto;
  transform: none;
}
@media (max-width: 900px) and (orientation: landscape) {
  .texas-roster-seat .texas-action-bubble:not(.texas-win-bubble) {
    bottom: calc(100% + 3px);
    font-size: clamp(8px, 1.5vh, 11px);
  }
  .texas-roster-seat--upper .texas-action-bubble:not(.texas-win-bubble) {
    top: calc(100% + 3px);
    bottom: auto;
  }
}

/* Dopo FOLD anche le due carte personali si spengono fino alla prossima mano. */
.texas-table--own-folded .texas-player img {
  filter: grayscale(1) brightness(.25);
  opacity: .42;
  transition: filter 220ms ease, opacity 220ms ease;
}

/* Disposizione mobile: posti sul bordo, feltro staccato dall'intestazione. */
@media (max-width: 900px) and (orientation: landscape) {
  .texas-opponents .texas-roster-seat {
    left: var(--mobile-seat-x) !important;
    top: var(--mobile-seat-y) !important;
  }
  .texas-opponents .texas-roster-seat[aria-label^="Il tuo posto"] {
    top: var(--mobile-seat-y) !important;
  }
  .texas-board {
    top: 47%;
    gap: clamp(3px, .5vw, 8px);
  }
  .texas-board span {
    width: clamp(34px, 9vh, 62px);
    border-width: 2px;
  }
  .texas-chip-preview { display: none; }
  .texas-opponents .texas-roster-seat {
    width: clamp(78px, 11vw, 124px);
  }
  .texas-roster-avatar {
    width: clamp(30px, 7vh, 42px);
    height: clamp(30px, 7vh, 42px);
    font-size: clamp(12px, 3vh, 16px);
  }
  .texas-roster-cards img {
    width: clamp(17px, 4vh, 26px);
  }
  .texas-roster-seat--revealed .texas-roster-cards img {
    width: clamp(23px, 5.4vh, 35px);
  }
  .texas-roster-name { font-size: clamp(9px, 2vh, 12px); }
  .texas-roster-stack { font-size: clamp(8px, 1.65vh, 10px); }
  .texas-board span { width: clamp(44px, 12vh, 82px); }
  .texas-player img { width: clamp(42px, 12vh, 78px); }
}

/* Uscita sempre disponibile nella barra delle azioni. */
.texas-action-bar .texas-action-exit {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 39px;
  padding: 6px 12px;
  border: 1px solid #f0ca70;
  border-radius: 7px;
  background: linear-gradient(#263850, #121e2e);
  color: #ffe6a4;
  font-size: 11px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}
.texas-action-bar .texas-action-exit:hover,
.texas-action-bar .texas-action-exit:focus-visible {
  background: #345375;
  outline: 2px solid #ffe6a4;
}
@media (max-width: 900px) and (orientation: landscape) {
  .texas-action-bar .texas-action-exit {
    min-height: 32px;
    padding: 3px 6px;
    font-size: 9px;
  }
}

.texas-access-denied {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  background: #071222;
  color: #fff;
  text-align: center;
}
.texas-access-denied h1 { margin: 0; color: #ffc928; }
.texas-access-denied p { max-width: 380px; line-height: 1.5; }
.texas-access-denied a {
  padding: 12px 20px;
  border: 1px solid #ffc928;
  border-radius: 9px;
  background: #16834f;
  color: #fff;
  font-weight: 800;
  text-decoration: none;
}

.texas-reserved-badge {
  display: block;
  padding: 1px 5px;
  border: 1px solid #f4cc66;
  border-radius: 7px;
  background: #243249;
  color: #ffe399;
  font-size: clamp(8px, .8vw, 11px);
  font-weight: 800;
  white-space: nowrap;
}
@media (max-width: 900px) and (orientation: landscape) {
  .texas-reserved-badge { font-size: 8px; padding: 0 3px; }
}

/* Mobile nickname setup: give the keyboard its own uncluttered screen. */
@media (max-width: 900px) and (orientation: landscape) {
  .texas-page.texas-nickname-entry,
  .texas-page.texas-nickname-entry .texas-shell {
    height: 100dvh;
    min-height: 0;
    overflow-y: auto;
  }
  .texas-page.texas-nickname-entry .texas-table,
  .texas-page.texas-nickname-entry .texas-player-panel,
  .texas-page.texas-nickname-entry .texas-hand-controls,
  .texas-page.texas-nickname-entry .desktop-game-footer,
  .texas-page.texas-nickname-entry .texas-shell > p {
    display: none !important;
  }
  .texas-page.texas-nickname-entry .texas-shell > form.texas-seat {
    box-sizing: border-box;
    display: flex !important;
    flex: 0 1 auto;
    flex-direction: column;
    align-items: stretch !important;
    width: min(440px, calc(100% - 24px));
    max-height: calc(100dvh - 68px);
    overflow-y: auto;
    margin: auto;
    padding: clamp(8px, 3vh, 20px);
    gap: 8px !important;
    border: 2px solid var(--texas-gold);
    border-radius: 14px;
    background: #102036;
    text-align: center;
  }
  .texas-page.texas-nickname-entry form.texas-seat label {
    display: block;
    font-size: clamp(14px, 3.5vh, 20px);
  }
  .texas-page.texas-nickname-entry form.texas-seat input.texas-seat {
    box-sizing: border-box;
    display: block;
    width: 100%;
    min-height: 40px;
    margin-top: 6px;
    font-size: 16px;
  }
  .texas-page.texas-nickname-entry form.texas-seat button {
    align-self: center;
    min-height: 38px;
    padding: 6px 24px;
    background: #16834f;
  }
  .texas-page.texas-nickname-entry form.texas-seat [role="status"] {
    font-size: 13px;
    line-height: 1.3;
  }
}

/* Desktop: lascia spazio al messaggio del tavolo e contiene i nomi lunghi. */
@media (min-width: 901px) {
  .texas-player-panel {
    grid-template-columns: minmax(0, .8fr) minmax(0, .65fr) minmax(0, 1.55fr);
  }
  .texas-player-panel--desktop-bottom > .texas-seat {
    padding-block: 4px;
  }
  .texas-player-panel > form.texas-seat { font-size: clamp(10px, .8vw, 13px); }
  .texas-player-panel > #texas-table-status {
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.2;
    padding-inline: 10px;
  }
}

/* Telefono orizzontale: stato e nickname restano nella rispettiva colonna. */
@media (max-width: 900px) and (orientation: landscape) {
  .texas-player-panel {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, .83fr) minmax(0, 1.47fr);
  }
  .texas-player-panel > form.texas-seat,
  .texas-player-panel > #texas-table-status { min-width: 0; }
  .texas-player-panel > form.texas-seat > span[role="status"] {
    display: inline-flex;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
  }
  .texas-player-panel > form.texas-seat .texas-panel-value {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .texas-player-panel > #texas-table-status {
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.15;
    padding-inline: 4px;
  }
  .texas-player-panel > #texas-table-status .texas-panel-value {
    min-width: 0;
    white-space: normal;
  }
}

/* Carte personali: visibili soltanto dopo l'ingresso effettivo al tavolo. */
.texas-table--spectating .texas-player { display: none; }
@media (max-width: 900px) and (orientation: landscape) {
  /* Lascia libera la zona delle carte comuni anche durante la mano. */
  .texas-player img { width: clamp(26px, 6.5vh, 46px); }
  .texas-opponents .texas-roster-seat[data-seat-kind="own"] .texas-roster-cards { display: none; }
}

/* Il posto centrale di uno spettatore non è la sua mano. */
.texas-panel-pot { display: none; }
@media (max-width: 900px) and (orientation: landscape) {
  /* Il piatto si legge nel pannello del nickname senza occupare una fascia. */
  .texas-roster-pot { display: none; }
  .texas-player-panel > form.texas-seat .texas-panel-pot {
    display: inline-block;
    flex: 0 0 auto;
    max-width: 42%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 2px 5px;
    border: 1px solid #ffc928;
    border-radius: 8px;
    background: #102132;
    color: #ffc928;
    font-size: clamp(8px, 1.8vh, 11px);
    font-weight: 800;
    box-shadow: 0 0 0 transparent;
    transition: box-shadow 220ms ease;
  }
  .texas-player-panel > form.texas-seat .texas-panel-pot--active {
    box-shadow: 0 0 8px rgba(255, 201, 40, .65);
  }
}

/* Il valore accanto al nickname compare solo sul telefono orizzontale. */
@media (min-width: 901px), (orientation: portrait) {
  .texas-player-panel > form.texas-seat .texas-panel-pot { display: none !important; }
}

/* PC: allinea il posto centrale dello spettatore ai due posti inferiori. */
@media (min-width: 901px) {
  .texas-opponents .texas-roster-seat--center-spectator { top: 85% !important; }
}

/* Il decimo posto è quello al centro in basso quando il tavolo è osservato. */
@media (min-width: 901px) {
  .texas-table--spectating .texas-opponents
  .texas-roster-seat[data-seat-no="10"]:not([data-seat-kind="pending"]) {
    top: 85% !important;
  }
}


/* Carte del giocatore reale e piatto compatto: rifinitura mobile. */
@media (max-width: 900px) and (orientation: landscape) {
  .texas-player-panel {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr) minmax(0, 1.25fr);
  }
  .texas-player-panel > form.texas-seat {
    gap: 5px !important;
    overflow: hidden;
  }
  .texas-player-panel > form.texas-seat > span[role="status"] {
    flex: 1 1 auto;
  }
  .texas-player-panel > form.texas-seat .texas-panel-pot {
    max-width: none;
    padding-inline: 6px;
  }
  .texas-table:not(.texas-table--spectating) .texas-player {
    z-index: 4;
    bottom: 11%;
    display: flex !important;
    gap: 4px;
    pointer-events: none;
  }
  .texas-table:not(.texas-table--spectating) .texas-player img {
    width: clamp(44px, 11vh, 72px);
    border-radius: 5px;
    filter: drop-shadow(0 4px 6px #000b);
  }
  .texas-opponents .texas-roster-seat[data-seat-kind="own"] {
    z-index: 6;
  }
}

.texas-panel-pot--pulse {
  animation: texas-pot-pulse 520ms ease-out;
}
.texas-roster-bet--enter {
  animation: texas-bet-arrive 420ms cubic-bezier(.2,.75,.25,1);
}
@keyframes texas-pot-pulse {
  0% { transform: scale(.82); background: #fff2a3; color: #132033; }
  55% { transform: scale(1.12); box-shadow: 0 0 16px rgba(255,201,40,.95); }
  100% { transform: scale(1); }
}
@keyframes texas-bet-arrive {
  from { opacity: 0; transform: translate(-50%, -12px) scale(.55); }
  to { opacity: 1; transform: translateX(-50%) scale(1); }
}
.texas-roster-seat[data-seat-kind="own"] .texas-roster-bet--enter {
  animation-name: texas-own-bet-arrive;
}
@keyframes texas-own-bet-arrive {
  from { opacity: 0; transform: translateY(-50%) translateX(-10px) scale(.55); }
  to { opacity: 1; transform: translateY(-50%) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .texas-panel-pot--pulse,
  .texas-roster-bet--enter { animation: none; }
}
/* Fiches del piatto assegnate al vincitore allo showdown. */
.texas-pot-award-chip {
  position: absolute;
  z-index: 18;
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border: 2px solid #fff4b0;
  border-radius: 50%;
  color: #fff7b7;
  background: radial-gradient(circle at 35% 30%, #ffe984, #d59600 58%, #643600);
  box-shadow: 0 0 8px #ffd83d, inset 0 0 0 3px rgba(72, 38, 0, .55);
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: texas-pot-award 950ms cubic-bezier(.2, .75, .28, 1) var(--award-delay) both;
}

@keyframes texas-pot-award {
  0% { transform: translate(-50%, -50%) scale(.75) rotate(0); opacity: 0; }
  15% { opacity: 1; }
  72% { opacity: 1; }
  100% {
    transform: translate(calc(-50% + var(--award-x)), calc(-50% + var(--award-y)))
      scale(.48) rotate(540deg);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .texas-pot-award-chip { animation-duration: 1ms; }
}


/* Il comando di uscita compare solo con posto prenotato o assegnato. */
.texas-action-bar .texas-action-exit[hidden] {
  display: none !important;
}


/* Mobile landscape finale: viewport poker sincronizzata.
   Il tavolo e le sedute scalano insieme su telefoni landscape diversi.
   SOLO resa mobile: nessuna logica di gioco. */
@media (max-width: 900px) and (orientation: landscape) {
  .texas-table {
    --mobile-table-w: min(72vw, 720px);
    --mobile-table-h: min(52vh, 315px);
    box-sizing: border-box;
    isolation: isolate;
    overflow: visible;
    background-color: #292728;
    background-image: none;
  }

  /* Feltro indipendente dal contenitore: centrato, più rotondo e con pavimento
     continuo attorno, come un vero tavolo visto dall'alto. */
  .texas-table::before {
    content: "";
    position: absolute;
    z-index: 0;
    left: 50%;
    top: 50%;
    width: var(--mobile-table-w);
    height: var(--mobile-table-h);
    transform: translate(-50%, -50%) perspective(700px) rotateX(5deg);
    transform-origin: center center;
    border: clamp(10px, 2vh, 17px) solid #171717;
    border-radius: 43% / 47%;
    background:
      radial-gradient(ellipse at 50% 32%, rgba(77,202,155,.30), transparent 50%),
      linear-gradient(180deg, #197b59 0%, #0d6247 54%, #084833 100%);
    box-shadow:
      inset 0 3px 0 rgba(115,235,191,.34),
      inset 0 -13px 18px rgba(0,0,0,.34),
      inset 0 0 0 3px rgba(72,214,163,.24),
      0 12px 0 #0a0a0b,
      0 20px 18px rgba(0,0,0,.72);
    pointer-events: none;
  }

  .texas-felt-brand {
    z-index: 1;
  }

  .texas-opponents,
  .texas-board,
  .texas-player {
    z-index: 2;
  }

  .texas-opponents .texas-roster-seat {
    left: var(--mobile-seat-x) !important;
    top: var(--mobile-seat-y) !important;
    width: clamp(74px, 10.2vw, 102px);
    z-index: 5;
  }

  .texas-roster-avatar {
    width: clamp(30px, 7vh, 42px);
    height: clamp(30px, 7vh, 42px);
  }

  .texas-roster-name {
    max-width: 100%;
    padding: 1px 5px;
    font-size: clamp(9px, 2vh, 12px);
  }

  .texas-roster-stack {
    font-size: clamp(8px, 1.7vh, 10px);
  }

  .texas-roster-cards {
    gap: 1px;
  }

  .texas-roster-cards img {
    width: clamp(21px, 5vh, 32px);
  }

  .texas-roster-seat--revealed .texas-roster-cards img {
    width: clamp(26px, 6.2vh, 39px);
  }

  .texas-board {
    top: 49%;
    gap: clamp(4px, .65vw, 8px);
  }

  .texas-board span {
    width: clamp(45px, 11.2vh, 72px);
  }

  .texas-table:not(.texas-table--spectating) .texas-player {
    bottom: 7%;
  }

  .texas-table:not(.texas-table--spectating) .texas-player img {
    width: clamp(44px, 10.5vh, 68px);
  }
}


/* Mobile landscape pulito: gerarchia più compatta per tenere nomi,
   dorsi e fiches fuori dal board centrale. */
@media (max-width: 900px) and (orientation: landscape) {
  .texas-opponents .texas-roster-seat {
    width: clamp(66px, 9vw, 88px);
  }
  .texas-roster-avatar {
    width: clamp(25px, 5.8vh, 34px);
    height: clamp(25px, 5.8vh, 34px);
  }
  .texas-roster-cards img {
    width: clamp(15px, 3.4vh, 21px);
  }
  .texas-roster-seat--revealed .texas-roster-cards img {
    width: clamp(20px, 4.5vh, 28px);
  }
  .texas-roster-name {
    padding: 1px 3px;
    font-size: clamp(8px, 1.65vh, 10px);
  }
  .texas-roster-stack {
    padding: 0 2px;
    font-size: clamp(7px, 1.35vh, 9px);
  }
  .texas-roster-bet {
    transform: translateX(-50%) scale(.88);
    transform-origin: center top;
  }
  .texas-board {
    top: 47%;
  }
  .texas-board span {
    width: clamp(46px, 11.5vh, 74px);
  }
}


/* Rifinitura mobile: carte più leggibili e spazio verticale
   per i messaggi azione. Nessuna modifica a desktop o logica Texas. */
@media (max-width: 900px) and (orientation: landscape) {
  .texas-roster-cards img {
    width: clamp(25px, 5.8vh, 35px);
  }
  .texas-roster-seat--revealed .texas-roster-cards img {
    width: clamp(31px, 7.2vh, 43px);
  }
  .texas-board span {
    width: clamp(52px, 13vh, 84px);
  }
  .texas-table:not(.texas-table--spectating) .texas-player img {
    width: clamp(50px, 12.5vh, 78px);
  }
  .texas-roster-action {
    max-width: 92px;
    white-space: nowrap;
  }
}


/* Mobile landscape: le fiches restano separate dalle carte sui tavoli 5/10.
   Heads-up: solo le carte vengono ingrandite leggermente. */
@media (max-width: 900px) and (orientation: landscape) {
  .texas-table[data-seat-limit="5"] .texas-roster-bet,
  .texas-table[data-seat-limit="10"] .texas-roster-bet {
    top: calc(100% + 12px);
  }
  .texas-table[data-seat-limit="5"] .texas-roster-seat--lower .texas-roster-bet,
  .texas-table[data-seat-limit="10"] .texas-roster-seat--lower .texas-roster-bet {
    top: auto;
    bottom: calc(100% + 12px);
  }
  .texas-table[data-seat-limit="2"] .texas-roster-cards img {
    width: clamp(56px, 13vh, 82px);
  }
  .texas-table[data-seat-limit="2"] .texas-roster-seat--revealed .texas-roster-cards img {
    width: clamp(35px, 8vh, 47px);
  }
  .texas-table[data-seat-limit="2"]:not(.texas-table--spectating) .texas-player img {
    width: clamp(55px, 13.5vh, 84px);
  }
}


/* Tavolo 10 mobile: puntate/fiches dentro il feltro e vicine al proprietario.
   Solo geometria mobile del tavolo a 10. */
@media (max-width: 900px) and (orientation: landscape) {
  .texas-table[data-seat-limit="10"] .texas-roster-seat[data-mobile-zone="left"] .texas-roster-bet {
    top: 50%;
    bottom: auto;
    left: calc(100% + 13px);
    transform: translateY(-50%) scale(.88);
  }
  .texas-table[data-seat-limit="10"] .texas-roster-seat[data-mobile-zone="right"] .texas-roster-bet {
    top: 50%;
    bottom: auto;
    left: auto;
    right: calc(100% + 13px);
    transform: translateY(-50%) scale(.88);
  }
  .texas-table[data-seat-limit="10"] .texas-roster-seat[data-mobile-zone="top"] .texas-roster-bet {
    top: calc(100% + 10px);
    bottom: auto;
  }
  .texas-table[data-seat-limit="10"] .texas-roster-seat[data-mobile-zone="bottom"] .texas-roster-bet {
    top: auto;
    bottom: calc(100% + 10px);
  }
}


/* Tavolo 10 mobile: solo le puntate dei due posti centrali.
   Alto-centro verso destra; posto proprio basso-centro verso sinistra. */
@media (max-width: 900px) and (orientation: landscape) {
  .texas-table[data-seat-limit="10"] .texas-opponents > .texas-roster-seat:nth-child(5) .texas-roster-bet {
    top: 50%;
    bottom: auto;
    left: calc(100% + 10px);
    right: auto;
    transform: translateY(-50%) scale(.88);
  }

  .texas-table[data-seat-limit="10"] .texas-roster-seat[data-seat-kind="own"] .texas-roster-bet {
    top: 50%;
    bottom: auto;
    left: auto;
    right: calc(100% + 10px);
    transform: translateY(-50%) scale(.88);
  }
}


/* Tavolo 10 mobile - rifinitura mirata:
   feltro leggermente più basso/compatto, board più piccolo e libero dai player,
   puntate dei tre posti centrali spostate lateralmente. */
@media (max-width: 900px) and (orientation: landscape) {
  .texas-table[data-seat-limit="10"] {
    --mobile-table-h: min(46vh, 278px);
  }

  .texas-table[data-seat-limit="10"]::before {
    top: 53%;
  }

  .texas-table[data-seat-limit="10"] .texas-board {
    top: 50%;
    gap: clamp(4px, .55vw, 7px);
  }

  .texas-table[data-seat-limit="10"] .texas-board span {
    width: clamp(44px, 10.5vh, 68px);
  }

  .texas-table[data-seat-limit="10"] .texas-opponents > .texas-roster-seat:nth-child(5) .texas-roster-bet {
    top: 58%;
    bottom: auto;
    left: calc(100% + 18px);
    right: auto;
    transform: translateY(-50%) scale(.82);
  }

  .texas-table[data-seat-limit="10"] .texas-opponents > .texas-roster-seat:first-child .texas-roster-bet {
    top: 50%;
    bottom: auto;
    left: auto;
    right: calc(100% + 18px);
    transform: translateY(-50%) scale(.82);
  }

  .texas-table[data-seat-limit="10"] .texas-roster-seat[data-seat-kind="own"] .texas-roster-bet {
    top: 50%;
    bottom: auto;
    left: auto;
    right: calc(100% + 18px);
    transform: translateY(-50%) scale(.82);
  }
}


/* Tavolo 10 mobile: SOLO puntata del posto proprio basso-centro.
   La porta a sinistra delle sue carte, dentro il feltro. */
@media (max-width: 900px) and (orientation: landscape) {
  .texas-table[data-seat-limit="10"] .texas-roster-seat[data-seat-kind="own"] .texas-roster-bet {
    top: 50%;
    bottom: auto;
    left: auto;
    right: calc(100% + 30px);
    transform: translateY(-50%) scale(.82);
  }
}


/* Tavolo 10 mobile: SOLO puntata del player basso-centro.
   La posizione finale e' a destra delle sue carte, nella zona verde libera. */
@media (max-width: 900px) and (orientation: landscape) {
  .texas-table[data-seat-limit="10"] .texas-roster-seat[data-seat-kind="own"] .texas-roster-bet {
    top: 50%;
    bottom: auto;
    left: calc(100% + 22px);
    right: auto;
    transform: translateY(-50%) scale(.82);
  }
}


/* Tavolo 10 mobile: puntata del SOLO posto grafico basso-centro.
   Il selettore usa il decimo posto visivo, non seat-kind, per funzionare
   anche quando quel posto e' occupato da un bot/altro giocatore. */
@media (max-width: 900px) and (orientation: landscape) {
  .texas-table[data-seat-limit="10"] .texas-opponents > .texas-roster-seat:nth-child(10) .texas-roster-bet {
    top: 50%;
    bottom: auto;
    left: calc(100% + 18px);
    right: auto;
    transform: translateY(-50%) scale(.82);
  }
}


/* Tavolo 10 mobile: SOLO puntata del posto basso-sinistra.
   La sposta nella zona verde interna a destra del player, separata
   dalla puntata del posto superiore. */
@media (max-width: 900px) and (orientation: landscape) {
  .texas-table[data-seat-limit="10"] .texas-opponents > .texas-roster-seat:nth-child(1) .texas-roster-bet {
    top: 35%;
    bottom: auto;
    left: calc(100% + 30px);
    right: auto;
    transform: translateY(-50%) scale(.82);
  }
}


/* Desktop: il saldo fiches del giocatore reale resta sopra la barra inferiore
   nei tavoli 2, 5 e 10 senza cambiare la geometria degli avversari. */
@media (min-width: 901px) {
  .texas-table:not(.texas-table--spectating)
    .texas-opponents .texas-roster-seat[data-seat-kind="own"] {
    transform: translate(-50%, calc(-50% - 30px));
    z-index: 9;
  }
}


/* Identita stanza Texas: sola etichetta informativa, nessuna logica di gioco. */
.texas-room-identity {
  position: absolute;
  z-index: 14;
  top: auto;
  right: auto;
  bottom: 3px;
  left: 10px;
  display: grid;
  gap: 2px;
  min-width: 124px;
  padding: 3px 7px;
  border: 1px solid rgba(255, 205, 43, .78);
  border-radius: 10px;
  background: rgba(5, 15, 24, .82);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .28);
  color: #fff;
  text-align: left;
  pointer-events: none;
}
.texas-room-identity[hidden] { display: none !important; }
.texas-room-identity strong {
  color: #ffd43b;
  font-size: 10px;
  line-height: 1.05;
  letter-spacing: .04em;
}
.texas-room-identity span {
  font-size: 7px;
  line-height: 1.05;
  opacity: .82;
}
@media (max-width: 900px) {
  .texas-room-identity {
    display: none !important;
  }
}


/* Heads-up mobile: le carte reali seguono il posto destro del giocatore.
   Solo geometria del tavolo da 2; desktop e tavoli 5/10 restano invariati. */
@media (max-width: 900px) and (orientation: landscape) {
  .texas-table[data-seat-limit="2"]:not(.texas-table--spectating) .texas-player {
    top: 50%;
    right: calc(9% + clamp(27px, 6.2vh, 39px));
    bottom: auto;
    left: auto;
    gap: 1px;
    transform: translateY(-50%);
  }

  .texas-table[data-seat-limit="2"]:not(.texas-table--spectating) .texas-player img {
    width: clamp(29px, 6.6vh, 40px);
    border-radius: 3px;
  }
}


/* Puntate radiali: ogni fiche resta vicino al proprio giocatore ma avanza
   verso il centro del feltro. Regola autorevole per tavoli 2/4/5/10. */
.texas-table .texas-opponents .texas-roster-seat {
  --texas-bet-inset: clamp(26px, 3.4vw, 52px);
}
.texas-table .texas-opponents
.texas-roster-seat[data-table-zone="top"] > .texas-roster-bet {
  top: calc(100% + var(--texas-bet-inset)) !important;
  right: auto !important;
  bottom: auto !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
}
.texas-table .texas-opponents
.texas-roster-seat[data-table-zone="bottom"] > .texas-roster-bet {
  top: auto !important;
  right: auto !important;
  bottom: calc(100% + var(--texas-bet-inset)) !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
}
.texas-table .texas-opponents
.texas-roster-seat[data-table-zone="left"] > .texas-roster-bet {
  top: 50% !important;
  right: auto !important;
  bottom: auto !important;
  left: calc(100% + var(--texas-bet-inset)) !important;
  transform: translateY(-50%) !important;
}
.texas-table .texas-opponents
.texas-roster-seat[data-table-zone="right"] > .texas-roster-bet {
  top: 50% !important;
  right: calc(100% + var(--texas-bet-inset)) !important;
  bottom: auto !important;
  left: auto !important;
  transform: translateY(-50%) !important;
}
@media (max-width: 900px) and (orientation: landscape) {
  .texas-table .texas-opponents .texas-roster-seat {
    --texas-bet-inset: clamp(12px, 2.5vw, 24px);
  }
  /* Sul telefono la geometria dedicata prevale su quella desktop. */
  .texas-table .texas-opponents
  .texas-roster-seat[data-mobile-zone="top"] > .texas-roster-bet {
    top: calc(100% + var(--texas-bet-inset)) !important;
    right: auto !important; bottom: auto !important; left: 50% !important;
    transform: translateX(-50%) !important;
  }
  .texas-table .texas-opponents
  .texas-roster-seat[data-mobile-zone="bottom"] > .texas-roster-bet {
    top: auto !important; right: auto !important;
    bottom: calc(100% + var(--texas-bet-inset)) !important;
    left: 50% !important; transform: translateX(-50%) !important;
  }
  .texas-table .texas-opponents
  .texas-roster-seat[data-mobile-zone="left"] > .texas-roster-bet {
    top: 50% !important; right: auto !important; bottom: auto !important;
    left: calc(100% + var(--texas-bet-inset)) !important;
    transform: translateY(-50%) !important;
  }
  .texas-table .texas-opponents
  .texas-roster-seat[data-mobile-zone="right"] > .texas-roster-bet {
    top: 50% !important;
    right: calc(100% + var(--texas-bet-inset)) !important;
    bottom: auto !important; left: auto !important;
    transform: translateY(-50%) !important;
  }
}


/* Regola finale del posto reale: prevale sulla geometria radiale.
   La puntata vive di lato, oltre la larghezza delle due carte personali. */
.texas-table .texas-opponents
.texas-roster-seat[data-seat-kind="own"] > .texas-roster-bet {
  top: 50% !important;
  right: auto !important;
  bottom: auto !important;
  left: calc(100% + 20px) !important;
  transform: translateY(-50%) !important;
}

@media (max-width: 900px) and (orientation: landscape) {
  .texas-table .texas-opponents
  .texas-roster-seat[data-seat-kind="own"] > .texas-roster-bet {
    left: calc(100% + clamp(28px, 6vw, 42px)) !important;
    transform: translateY(-50%) scale(.82) !important;
  }
}


/* Layout autorevole del centro tavolo:
   piatto sotto le carte comuni e puntata reale sotto il logo.
   Le puntate dei bot conservano la geometria radiale. */
.texas-table .texas-roster-pot {
  z-index: 7;
  display: block !important;
}
.texas-player-panel .texas-panel-pot {
  display: none !important;
}
.texas-table > .texas-own-wager {
  position: absolute;
  z-index: 12;
  top: 63% !important;
  right: auto !important;
  bottom: auto !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  transform-origin: center !important;
}
.texas-table > .texas-own-wager.texas-roster-bet--enter {
  animation-name: texas-own-wager-center-arrive;
}
@keyframes texas-own-wager-center-arrive {
  from { opacity: 0; transform: translate(-50%, -70%) scale(.55); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@media (max-width: 900px) and (orientation: landscape) {
  .texas-table > .texas-own-wager {
    top: 64% !important;
    padding: 1px 3px 5px;
    transform: translate(-50%, -50%) scale(.82) !important;
  }
  .texas-table > .texas-own-wager.texas-roster-bet--enter {
    animation-name: none;
  }
}

/* Mobile landscape: stessa riga del nickname, senza riquadro.
   La barra superiore tiene il piatto fuori dal feltro e dai giocatori. */
@media (max-width: 900px) and (orientation: landscape) {
  .texas-table .texas-roster-pot {
    display: none !important;
  }
  .texas-player-panel > form.texas-seat {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0 !important;
    overflow: hidden;
    padding-inline: 8px;
  }
  .texas-player-panel > form.texas-seat > span[role="status"] {
    flex: 0 1 auto;
    min-width: 0;
  }
  .texas-player-panel > form.texas-seat .texas-panel-pot {
    display: inline !important;
    flex: 0 0 auto;
    width: auto;
    max-width: none;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    color: #ff5d61;
    box-shadow: none;
    font: inherit;
    font-weight: 900;
    line-height: inherit;
    text-align: left;
    text-shadow: 0 0 7px rgba(255, 75, 80, .5);
    white-space: nowrap;
  }
  .texas-player-panel > form.texas-seat .texas-panel-pot::before {
    content: "/";
    margin: 0 7px;
    color: #ffe08a;
    text-shadow: none;
  }
  .texas-player-panel > form.texas-seat .texas-panel-pot--active {
    box-shadow: none;
  }
  .texas-player-panel > form.texas-seat .texas-panel-pot--pulse {
    animation: texas-pot-text-pulse 520ms ease-out;
  }
}
@keyframes texas-pot-text-pulse {
  0% { transform: scale(.9); color: #ff5d61; }
  55% { transform: scale(1.12); color: #ffb0b2; text-shadow: 0 0 15px #ff484e; }
  100% { transform: scale(1); }
}

/* Barra del turno desktop: il tempo deriva dalla RPC, mai dal solo browser. */
@media (min-width: 901px) {
  .texas-roster-seat .texas-turn-clock {
    left: 50%;
    right: auto;
    top: calc(100% + 3px);
    box-sizing: border-box;
    display: grid;
    gap: 3px;
    width: min(100%, 112px);
    min-width: 0;
    padding: 3px 6px 5px;
    transform: translateX(-50%);
    border-color: #9ceac1;
    background: rgba(6, 25, 32, .96);
    color: #d8ffe7;
    box-shadow: 0 3px 8px #0009;
    pointer-events: none;
  }
  .texas-turn-progress {
    display: block;
    overflow: hidden;
    width: 100%;
    height: 5px;
    border-radius: 9px;
    background: #394656;
  }
  .texas-turn-progress-fill {
    display: block;
    width: var(--texas-turn-progress, 100%);
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #2aba67, #a6ec77);
    transition: width 900ms linear, background-color 200ms;
  }
  .texas-roster-seat .texas-turn-clock--urgent {
    border-color: #ff5757;
    color: #ffb2b2;
  }
  .texas-turn-clock--urgent .texas-turn-progress-fill {
    background: #ff474c;
  }
}
@media (prefers-reduced-motion: reduce) {
  .texas-turn-progress-fill { transition: none; }
}

/* Lobby e tavolo in finestra sul solo desktop. */
@media (min-width: 901px) {
  .texas-desktop-lobby {
    box-sizing: border-box;
    max-width: 1380px;
    min-height: 100dvh;
    margin: 0 auto;
    padding: 28px clamp(20px, 4vw, 64px);
    background: #091421;
    color: #fff;
  }
  .texas-desktop-lobby > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 2px solid #ffc928;
  }
  .texas-desktop-lobby h1 { color: #ffc928; font-size: clamp(22px, 2vw, 32px); }
  .texas-desktop-lobby a { color: #ffd451; }
  .texas-desktop-lobby > p { color: #baccdf; }
  .texas-lobby-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 14px;
    margin: 25px 0;
  }
  .texas-lobby-room {
    display: grid;
    gap: 8px;
    min-height: 112px;
    padding: 18px;
    border: 1px solid #4c687b;
    border-radius: 12px;
    background: #12273a;
    color: #fff;
    text-align: left;
    cursor: pointer;
  }
  .texas-lobby-room:hover, .texas-lobby-room:focus-visible,
  .texas-lobby-room[aria-current="true"] {
    border-color: #ffc928;
    background: #193b49;
  }
  .texas-lobby-room strong { color: #ffd451; }
  .texas-lobby-room small { color: #abc4d2; }
  .texas-lobby-empty { grid-column: 1 / -1; }
  .texas-lobby-formats {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    border-top: 1px solid #36516a;
    padding-top: 18px;
  }
  .texas-lobby-formats button, .texas-desktop-room-bar button {
    border: 1px solid #ffc928;
    border-radius: 9px;
    padding: 9px 14px;
    background: #193849;
    color: #fff;
    font: inherit;
    cursor: pointer;
  }
  .texas-desktop-room-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 15px;
    background: #102235;
    color: #c9dbe7;
  }
  .texas-desktop-lobby-ready:not(.texas-desktop-table-open) > .texas-shell {
    display: none;
  }
  .texas-desktop-table-open::before {
    position: fixed;
    z-index: 99;
    inset: 0;
    background: rgba(1, 6, 13, .74);
    content: "";
  }
  .texas-desktop-table-open > .texas-shell {
    position: fixed;
    z-index: 100;
    top: 3dvh;
    left: 50%;
    box-sizing: border-box;
    width: min(94vw, 1560px, max(860px, calc((94dvh - 150px) * 16 / 9)));
    max-height: 94dvh;
    margin: 0;
    overflow: auto;
    transform: translateX(-50%);
    box-shadow: 0 25px 90px #000e;
  }
  .texas-desktop-table-open .texas-table {
    height: auto;
    min-height: 480px;
    aspect-ratio: 16 / 9;
  }
  .texas-desktop-table-open { overflow: hidden; }
}
@media (max-width: 900px) {
  .texas-desktop-lobby, .texas-desktop-room-bar { display: none !important; }
}

/* Le tinte identificano il formato anche con molte stanze nella griglia PC. */
@media (min-width: 901px) {
  .texas-lobby-room {
    --room-accent: #79abc5;
    --room-surface: #172d3b;
    position: relative;
    align-content: start;
    gap: 7px;
    min-height: 130px;
    border-top: 4px solid var(--room-accent);
    background: linear-gradient(150deg, var(--room-surface), #10202f 90%);
    transition: transform 160ms ease, box-shadow 160ms ease;
  }
  .texas-lobby-room--2 {
    --room-accent: #ff8b91;
    --room-surface: #53283c;
  }
  .texas-lobby-room--4 {
    --room-accent: #ffce78;
    --room-surface: #604522;
  }
  .texas-lobby-room--5 {
    --room-accent: #77e7ba;
    --room-surface: #194e48;
  }
  .texas-lobby-room--10 {
    --room-accent: #99bcff;
    --room-surface: #273d68;
  }
  .texas-lobby-room strong {
    color: var(--room-accent);
    font-size: 14px;
  }
  .texas-lobby-room > span:not(.texas-lobby-room-state) {
    font-size: 13px;
    font-weight: 700;
  }
  .texas-lobby-room-meta {
    font-size: 12px;
    color: #ecf2f7 !important;
  }
  .texas-lobby-room-state {
    justify-self: start;
    margin-top: 5px;
    padding: 4px 8px;
    border: 1px solid #849aab;
    border-radius: 100px;
    background: #102131a8;
    color: #d4dfeb;
    font-size: 11px;
    font-weight: 700;
  }
  .texas-lobby-room-state--playing {
    border-color: #7ee5ae;
    color: #b5ffd0;
  }
  .texas-lobby-room:hover, .texas-lobby-room:focus-visible,
  .texas-lobby-room[aria-current="true"] {
    border-color: var(--room-accent);
    box-shadow: 0 0 0 1px var(--room-accent), 0 10px 25px #0008;
    transform: translateY(-2px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .texas-lobby-room { transition: none; }
}

/* Nel popup PC il ritorno passa da STANZE, senza il secondo collegamento. */
@media (min-width: 901px) {
  .texas-desktop-lobby-ready .texas-table .texas-return-home {
    display: none;
  }
}

/* Guida centrale nella pagina stanze. Lo scorrimento della pagina resta nativo. */
@media (min-width: 901px) {
  .texas-lobby-article {
    box-sizing: border-box;
    width: min(100%, 1080px);
    margin: clamp(32px, 5vh, 64px) auto 60px;
    padding: 28px clamp(28px, 4vw, 56px);
    border: 1px solid #3b5970;
    border-top: 3px solid var(--texas-gold);
    border-radius: 16px;
    background: linear-gradient(155deg, #14283a, #0b1b29);
    color: #e4edf5;
    box-shadow: 0 20px 38px #0005;
    text-align: center;
  }
  .texas-lobby-article h2 {
    margin: 0 0 22px;
    color: #ffd451;
    font-size: clamp(22px, 2.3vw, 31px);
    line-height: 1.2;
  }
  .texas-lobby-article h3 {
    margin: 25px 0 10px;
    color: #ffda75;
    font-size: 21px;
  }
  .texas-lobby-article h4 {
    margin: 20px 0 9px;
    color: #a5edcf;
    font-size: 17px;
  }
  .texas-lobby-article p {
    margin: 0 auto 13px;
    max-width: 100ch;
    font-size: 15px;
    line-height: 1.7;
    overflow-wrap: anywhere;
  }
  .texas-desktop-table-open > .texas-shell {
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-gutter: stable;
    overscroll-behavior: contain;
  }
}

/* Sul PC la rotellina elenca stanze reali, compresi tavoli dello stesso formato. */
@media (min-width: 901px) {
  .texas-settings--rooms .texas-settings-menu {
    width: min(480px, 76vw);
    max-height: min(320px, 50dvh);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .texas-settings--rooms .texas-format-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .texas-settings--rooms .texas-format-card--room {
    min-height: 90px;
  }
  .texas-settings--rooms .texas-format-card--room > span {
    font-size: 11px;
    overflow-wrap: anywhere;
  }
  .texas-settings--rooms .texas-format-card--room > small {
    font-size: 9px;
  }
  .texas-desktop-room-hint {
    color: #ffdf81;
    font-weight: 700;
  }
}

/* PC: dimensioni proporzionali al tavolo, con scorrimento nel popup
   quando lo zoom o un monitor basso non lasciano spazio sufficiente. */
@media (min-width: 901px) {
  .texas-desktop-table-open .texas-table .texas-roster-seat {
    --texas-bet-inset: clamp(12px, min(1.6vw, 2.5vh), 28px);
  }
  .texas-desktop-table-open .texas-opponents .texas-roster-seat {
    width: clamp(76px, 8.5vw, 118px);
  }
  .texas-desktop-table-open .texas-roster-bet {
    gap: 4px;
    padding-inline: 4px;
  }
}

/* PC: le stanze sono la prima schermata anche durante accesso e nickname.
   Il tavolo si apre solo dopo la scelta di una card (o una sessione cash attiva). */
/* The loading view and the populated lobby use the same section and layout. */
.texas-desktop-entry-placeholder { display: none; }
@media (min-width: 901px) {
  .texas-entry-loading > .texas-shell { display: none !important; }
  .texas-entry-loading > .texas-desktop-entry-placeholder { display: block; }
  .texas-desktop-lobby > header { flex-wrap: wrap; }
}

/* Primo accesso PC: se manca il nickname, mostra soltanto il modulo. */
@media (min-width: 901px) {
  .texas-page.texas-nickname-entry .texas-table,
  .texas-page.texas-nickname-entry .texas-player-panel,
  .texas-page.texas-nickname-entry .texas-hand-controls,
  .texas-page.texas-nickname-entry .desktop-game-footer,
  .texas-page.texas-nickname-entry .texas-shell > p { display: none !important; }
  .texas-page.texas-nickname-entry .texas-shell { min-height: 100dvh; }
  .texas-page.texas-nickname-entry .texas-shell > form.texas-seat {
    box-sizing: border-box;
    width: min(440px, calc(100% - 32px));
    margin: clamp(40px, 18vh, 160px) auto;
    padding: 20px;
    border: 1px solid var(--texas-gold);
    border-radius: 12px;
    background: #102036;
  }
}

/* Avvisi di cambio stanza leggibili anche quando il pannello mobile è nascosto. */
.texas-room-notice {
  position: absolute;
  top: 2%; left: 50%; transform: translateX(-50%);
  z-index: 45; box-sizing: border-box; max-width: 68%;
  padding: 7px 12px; border: 1px solid #ffc928; border-radius: 9px;
  background: #071522f2; color: #ffe18a; font: bold 12px Arial, sans-serif;
  text-align: center; pointer-events: none;
}
.texas-room-notice[hidden] { display: none; }
@media (min-width: 901px) {
  .texas-desktop-table-open > .texas-shell {
    top: 50%; transform: translate(-50%, -50%);
    border-radius: 16px;
    width: min(94vw, 1480px);
    max-height: 94dvh;
  }
  .texas-desktop-table-open .texas-table {
    height: clamp(340px, calc(94dvh - 230px), 760px);
    min-height: 0;
    aspect-ratio: auto;
  }
}

