/* =========================================================
   CHESSTRX — ARENA MODERNA DEFINITIVA V3
   Solo mejora la arena. No modifica la bienvenida.
========================================================= */

:root {
  --arena-v3-cyan: #00eaff;
  --arena-v3-cyan-light: #89faff;
  --arena-v3-cyan-dark: #008ea8;

  --arena-v3-gold: #f5c85b;
  --arena-v3-gold-light: #ffe7a0;

  --arena-v3-green: #68ff35;
  --arena-v3-red: #ff5067;

  --arena-v3-bg: #020711;
  --arena-v3-panel: rgba(4, 18, 34, 0.93);
  --arena-v3-panel-light: rgba(10, 35, 57, 0.88);

  --arena-v3-border: rgba(0, 234, 255, 0.32);
  --arena-v3-border-soft: rgba(255, 255, 255, 0.075);

  --arena-v3-text: #f7fbff;
  --arena-v3-muted: #92a4ba;
}

/* Transición al entrar desde la bienvenida */

.app {
  transition:
    opacity 0.38s ease,
    transform 0.38s ease;
}

body.chesstrx-arena-live-v3 .app {
  animation:
    chesstrxArenaRevealV3
    0.48s
    ease-out
    both;
}

@keyframes chesstrxArenaRevealV3 {
  from {
    opacity: 0;
    transform: translateY(11px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================================================
   ENCABEZADO PRINCIPAL
========================================================= */

.app > h1 {
  margin-bottom: 18px !important;
}

.chesstrx-main-brand-icon {
  position: relative;
  overflow: hidden;
  border:
    1px solid rgba(255, 232, 154, 0.45);
  box-shadow:
    0 9px 25px rgba(245, 200, 91, 0.20),
    inset 0 1px 0 rgba(255, 255, 255, 0.55) !important;
}

.chesstrx-main-brand-icon::after {
  content: "";
  position: absolute;
  inset: -60% -30%;
  transform: rotate(25deg);
  background:
    linear-gradient(
      90deg,
      transparent,
      rgba(255, 255, 255, 0.50),
      transparent
    );
  animation:
    chesstrxLogoShineV3
    5.5s
    ease-in-out
    infinite;
}

@keyframes chesstrxLogoShineV3 {
  0%,
  70% {
    transform:
      translateX(-130%)
      rotate(25deg);
  }

  100% {
    transform:
      translateX(130%)
      rotate(25deg);
  }
}

/* =========================================================
   PANEL COMPETITIVO: TIEMPO + JUGADORES + ESTADO
========================================================= */

.chesstrx-match-hud-v3 {
  position: relative;
  margin-bottom: 18px;
  padding: 15px;
  overflow: hidden;

  border:
    1px solid var(--arena-v3-border);
  border-radius: 27px;

  background:
    radial-gradient(
      circle at 50% 0%,
      rgba(0, 234, 255, 0.09),
      transparent 38%
    ),
    linear-gradient(
      155deg,
      rgba(8, 32, 53, 0.95),
      rgba(2, 10, 21, 0.98)
    );

  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.46),
    0 0 30px rgba(0, 234, 255, 0.075),
    inset 0 1px 0 rgba(255, 255, 255, 0.055);

  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.chesstrx-match-hud-v3::before {
  content: "";
  position: absolute;
  inset: 0 13% auto;
  height: 2px;

  background:
    linear-gradient(
      90deg,
      transparent,
      var(--arena-v3-cyan),
      #ffffff,
      var(--arena-v3-gold),
      transparent
    );

  box-shadow:
    0 0 14px rgba(0, 234, 255, 0.55);
}

/* Tiempo integrado */

.chesstrx-match-hud-v3 .timer {
  position: relative;
  width: max-content;
  min-width: 145px;
  margin:
    0 auto
    14px !important;
  padding:
    8px
    20px
    10px !important;

  color: var(--arena-v3-muted);
  text-align: center;

  border:
    1px solid rgba(0, 234, 255, 0.18) !important;
  border-radius: 16px !important;

  background:
    rgba(0, 234, 255, 0.045) !important;

  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04) !important;
}

.chesstrx-match-hud-v3 .timer::before,
.chesstrx-match-hud-v3 .timer::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 46px;
  height: 1px;

  background:
    linear-gradient(
      90deg,
      transparent,
      rgba(0, 234, 255, 0.5)
    );
}

.chesstrx-match-hud-v3 .timer::before {
  right: calc(100% + 9px);
}

.chesstrx-match-hud-v3 .timer::after {
  left: calc(100% + 9px);
  transform: rotate(180deg);
}

.chesstrx-match-hud-v3 #gameTimer {
  margin-top: 2px;
  color: var(--arena-v3-cyan);
  font-size: 30px !important;
  font-weight: 950;
  letter-spacing: 2.4px;

  text-shadow:
    0 0 9px rgba(0, 234, 255, 0.65),
    0 0 22px rgba(0, 234, 255, 0.25);
}

/* Composición jugador VS rival */

.chesstrx-match-hud-v3 .top-info {
  display: grid !important;
  grid-template-columns:
    minmax(0, 1fr)
    46px
    minmax(0, 1fr);

  align-items: stretch;
  gap: 9px !important;

  margin:
    0
    0
    12px !important;
}

.chesstrx-match-hud-v3 .player-box {
  display: grid !important;

  grid-template-columns:
    43px
    minmax(0, 1fr);

  grid-template-areas:
    "emblem title"
    "emblem name"
    "emblem balance";

  column-gap: 10px;
  align-items: center;

  min-width: 0;
  padding:
    13px
    11px !important;

  text-align: left !important;

  border-radius: 19px !important;

  background:
    linear-gradient(
      145deg,
      rgba(12, 42, 67, 0.83),
      rgba(2, 14, 27, 0.92)
    ) !important;

  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.045),
    0 10px 25px rgba(0, 0, 0, 0.22) !important;
}

.chesstrx-match-hud-v3
.player-box.player-self-v3 {
  border-color:
    rgba(0, 234, 255, 0.42) !important;
}

.chesstrx-match-hud-v3
.player-box.player-rival-v3 {
  border-color:
    rgba(245, 200, 91, 0.34) !important;
}

.chesstrx-player-emblem-v3 {
  grid-area: emblem;

  display: grid;
  place-items: center;

  width: 43px;
  height: 43px;

  font-size: 25px;
  line-height: 1;

  border-radius: 14px;
}

.player-self-v3
.chesstrx-player-emblem-v3 {
  color: var(--arena-v3-cyan-light);

  border:
    1px solid rgba(0, 234, 255, 0.30);

  background:
    rgba(0, 234, 255, 0.08);

  box-shadow:
    0 0 18px rgba(0, 234, 255, 0.13);
}

.player-rival-v3
.chesstrx-player-emblem-v3 {
  color: var(--arena-v3-gold-light);

  border:
    1px solid rgba(245, 200, 91, 0.27);

  background:
    rgba(245, 200, 91, 0.075);

  box-shadow:
    0 0 18px rgba(245, 200, 91, 0.10);
}

.chesstrx-match-hud-v3 .player-title {
  grid-area: title;

  margin: 0 !important;

  color: var(--arena-v3-muted) !important;
  font-size: 9px !important;
  font-weight: 900 !important;
  letter-spacing: 1.8px;
}

.chesstrx-match-hud-v3 .player-id {
  grid-area: name;

  overflow: hidden;
  margin: 2px 0 0 !important;

  color: var(--arena-v3-text) !important;
  font-size:
    clamp(
      12px,
      3.5vw,
      16px
    ) !important;

  font-weight: 900 !important;
  line-height: 1.2;

  text-overflow: ellipsis;
  white-space: nowrap;
}

.chesstrx-match-hud-v3
.player-self-v3
.player-id {
  color:
    var(--arena-v3-cyan-light) !important;
}

.chesstrx-match-hud-v3
.player-rival-v3
.player-id {
  color:
    var(--arena-v3-gold-light) !important;
}

.chesstrx-match-hud-v3 .player-balance {
  grid-area: balance;

  overflow: hidden;
  margin: 5px 0 0 !important;

  color: var(--arena-v3-green) !important;
  font-size:
    clamp(
      14px,
      4vw,
      20px
    ) !important;

  font-weight: 950 !important;
  line-height: 1.15;

  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Insignia VS */

.chesstrx-vs-badge-v3 {
  align-self: center;

  display: grid;
  place-items: center;

  width: 44px;
  height: 44px;

  color: #07121c;
  font-size: 13px;
  font-weight: 950;
  letter-spacing: -0.5px;

  border:
    1px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;

  background:
    linear-gradient(
      145deg,
      #ffffff,
      var(--arena-v3-gold)
    );

  box-shadow:
    0 8px 20px rgba(245, 200, 91, 0.18),
    0 0 0 5px rgba(255, 255, 255, 0.025);
}

/* Estado integrado */

.chesstrx-match-hud-v3 .status {
  position: relative;

  margin: 0 !important;
  padding:
    11px
    15px
    11px
    38px !important;

  color: #eaf6ff;
  font-size: 14px !important;
  font-weight: 800;
  text-align: left !important;

  border:
    1px solid rgba(104, 255, 53, 0.15) !important;
  border-radius: 14px !important;

  background:
    rgba(104, 255, 53, 0.035) !important;

  box-shadow:
    none !important;
}

.chesstrx-match-hud-v3 .status::before {
  content: "";

  position: absolute;
  top: 50%;
  left: 16px;

  width: 10px;
  height: 10px;

  transform: translateY(-50%);

  border-radius: 50%;

  background:
    var(--arena-v3-green);

  box-shadow:
    0 0 0 5px rgba(104, 255, 53, 0.08),
    0 0 13px rgba(104, 255, 53, 0.55);

  animation:
    chesstrxStatusPulseV3
    2s
    ease-in-out
    infinite;
}

@keyframes chesstrxStatusPulseV3 {
  0%,
  100% {
    opacity: 0.65;
    transform:
      translateY(-50%)
      scale(0.86);
  }

  50% {
    opacity: 1;
    transform:
      translateY(-50%)
      scale(1);
  }
}

/* =========================================================
   ESCENARIO Y TABLERO
========================================================= */

.chesstrx-board-stage-v3 {
  position: relative;

  margin-bottom: 18px;
  padding:
    11px
    10px
    14px;

  overflow: hidden;

  border:
    1px solid rgba(0, 234, 255, 0.30);
  border-radius: 28px;

  background:
    radial-gradient(
      circle at 50% 0%,
      rgba(0, 234, 255, 0.09),
      transparent 42%
    ),
    linear-gradient(
      160deg,
      rgba(6, 27, 46, 0.96),
      rgba(1, 8, 17, 0.99)
    );

  box-shadow:
    0 28px 68px rgba(0, 0, 0, 0.55),
    0 0 34px rgba(0, 234, 255, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.chesstrx-board-stage-v3::before,
.chesstrx-board-stage-v3::after {
  content: "";

  position: absolute;

  width: 53px;
  height: 53px;

  pointer-events: none;
}

.chesstrx-board-stage-v3::before {
  top: 7px;
  left: 7px;

  border-top:
    2px solid var(--arena-v3-cyan);
  border-left:
    2px solid var(--arena-v3-cyan);
  border-radius:
    16px
    0
    0
    0;
}

.chesstrx-board-stage-v3::after {
  right: 7px;
  bottom: 7px;

  border-right:
    2px solid var(--arena-v3-gold);
  border-bottom:
    2px solid var(--arena-v3-gold);
  border-radius:
    0
    0
    16px
    0;
}

.chesstrx-board-stage-head-v3 {
  display: flex;
  align-items: center;
  justify-content: space-between;

  padding:
    4px
    8px
    11px;

  color: var(--arena-v3-muted);
}

.chesstrx-board-stage-title-v3 {
  display: flex;
  align-items: center;
  gap: 8px;

  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1.7px;
  text-transform: uppercase;
}

.chesstrx-board-stage-title-v3::before {
  content: "♞";

  display: grid;
  place-items: center;

  width: 28px;
  height: 28px;

  color: var(--arena-v3-cyan);
  font-size: 17px;

  border:
    1px solid rgba(0, 234, 255, 0.22);
  border-radius: 9px;

  background:
    rgba(0, 234, 255, 0.055);
}

.chesstrx-board-stage-online-v3 {
  position: relative;

  padding-left: 13px;

  color: var(--arena-v3-cyan-light);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.chesstrx-board-stage-online-v3::before {
  content: "";

  position: absolute;
  top: 50%;
  left: 0;

  width: 6px;
  height: 6px;

  transform: translateY(-50%);

  border-radius: 50%;

  background: var(--arena-v3-green);

  box-shadow:
    0 0 9px rgba(104, 255, 53, 0.75);
}

/* El marco grueso anterior se convierte en un marco moderno */

.chesstrx-board-stage-v3 .board-wrap {
  position: relative;

  margin: 0 !important;
  padding: 7px;

  border:
    1px solid rgba(0, 234, 255, 0.22);
  border-radius: 22px;

  background:
    linear-gradient(
      145deg,
      rgba(0, 234, 255, 0.075),
      rgba(245, 200, 91, 0.035)
    );

  filter:
    drop-shadow(
      0 17px 25px
      rgba(0, 0, 0, 0.46)
    ) !important;
}

.chesstrx-board-stage-v3 #board,
.chesstrx-board-stage-v3 .board {
  overflow: hidden;

  border:
    2px solid
    rgba(0, 234, 255, 0.78) !important;

  border-radius:
    16px !important;

  background: #061321;

  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04),
    0 0 24px rgba(0, 234, 255, 0.20),
    inset 0 0 25px rgba(0, 0, 0, 0.20) !important;
}

/* Casillas con profundidad más elegante */

.chesstrx-board-stage-v3
#board
.square.light,
.chesstrx-board-stage-v3
.board
.square.light {
  background:
    linear-gradient(
      145deg,
      #245779,
      #163d5d
    ) !important;
}

.chesstrx-board-stage-v3
#board
.square.dark,
.chesstrx-board-stage-v3
.board
.square.dark {
  background:
    linear-gradient(
      145deg,
      #071c2e,
      #03121f
    ) !important;
}

.chesstrx-board-stage-v3 .square {
  position: relative;

  text-shadow:
    0 2px 1px rgba(0, 0, 0, 0.85),
    0 0 7px rgba(0, 234, 255, 0.42) !important;

  transition:
    filter 0.13s ease,
    transform 0.13s ease,
    box-shadow 0.13s ease !important;
}

.chesstrx-board-stage-v3
.square:hover {
  filter: brightness(1.06);
}

.chesstrx-board-stage-v3
.square:active {
  transform: scale(0.97);
}

/* Selección y movimientos compatibles con varias clases */

.chesstrx-board-stage-v3
.square.selected,
.chesstrx-board-stage-v3
.square.is-selected {
  box-shadow:
    inset 0 0 0 4px
    rgba(245, 200, 91, 0.78) !important;

  filter: brightness(1.16);
}

.chesstrx-board-stage-v3
.square.legal,
.chesstrx-board-stage-v3
.square.legal-target,
.chesstrx-board-stage-v3
.square.possible-move {
  box-shadow:
    inset 0 0 0 4px
    rgba(104, 255, 53, 0.38) !important;
}

/* Coordenadas */

.chesstrx-board-stage-v3
.coordinates,
.chesstrx-board-stage-v3
.ranks,
.chesstrx-board-stage-v3
.files {
  color:
    var(--arena-v3-cyan) !important;

  font-weight: 900 !important;

  text-shadow:
    0 0 9px
    rgba(0, 234, 255, 0.38);
}

/* =========================================================
   CONTROLES DE APUESTAS
========================================================= */

.chesstrx-action-dock-v3 {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px !important;

  margin:
    0
    0
    16px !important;

  padding: 11px !important;

  border:
    1px solid rgba(0, 234, 255, 0.22);
  border-radius: 20px;

  background:
    linear-gradient(
      145deg,
      rgba(8, 31, 51, 0.84),
      rgba(2, 12, 24, 0.92)
    );

  box-shadow:
    0 15px 34px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.chesstrx-action-dock-v3 input {
  flex:
    1
    1
    115px;

  margin: 0 !important;
}

.chesstrx-action-dock-v3 button {
  flex:
    1
    1
    145px;

  margin: 0 !important;
}

.chesstrx-action-dock-v3
#createBetBtn {
  color: #171006;

  background:
    linear-gradient(
      145deg,
      #fff0ad,
      var(--arena-v3-gold)
    ) !important;

  box-shadow:
    0 10px 24px rgba(245, 200, 91, 0.19) !important;
}

/* =========================================================
   PANELES INFERIORES
========================================================= */

#dghLobbyPanel,
.moves,
.stats,
#chessRankingPanel,
.ranking-panel {
  position: relative;

  overflow: hidden;

  border-color:
    rgba(0, 234, 255, 0.25) !important;

  background:
    linear-gradient(
      150deg,
      rgba(7, 27, 45, 0.92),
      rgba(2, 11, 21, 0.96)
    ) !important;

  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.04) !important;
}

#dghLobbyPanel::before,
.moves::before,
.stats::before,
#chessRankingPanel::before {
  content: "";

  position: absolute;
  top: 0;
  left: 20px;
  right: 20px;

  height: 1px;

  background:
    linear-gradient(
      90deg,
      transparent,
      rgba(0, 234, 255, 0.60),
      transparent
    );
}

/* =========================================================
   ADAPTACIÓN PARA MÓVILES PEQUEÑOS
========================================================= */

@media (max-width: 410px) {
  .chesstrx-match-hud-v3 {
    padding:
      13px
      10px;
    border-radius: 23px;
  }

  .chesstrx-match-hud-v3
  .top-info {
    grid-template-columns:
      minmax(0, 1fr)
      37px
      minmax(0, 1fr);

    gap: 5px !important;
  }

  .chesstrx-match-hud-v3
  .player-box {
    grid-template-columns:
      34px
      minmax(0, 1fr);

    column-gap: 7px;

    padding:
      11px
      7px !important;

    border-radius: 16px !important;
  }

  .chesstrx-player-emblem-v3 {
    width: 34px;
    height: 34px;

    font-size: 20px;
    border-radius: 11px;
  }

  .chesstrx-vs-badge-v3 {
    width: 35px;
    height: 35px;

    font-size: 11px;
  }

  .chesstrx-match-hud-v3
  .player-title {
    font-size: 8px !important;
    letter-spacing: 1.3px;
  }

  .chesstrx-match-hud-v3
  .player-id {
    font-size: 12px !important;
  }

  .chesstrx-match-hud-v3
  .player-balance {
    font-size:
      clamp(
        12px,
        3.7vw,
        16px
      ) !important;
  }

  .chesstrx-match-hud-v3
  .timer::before,
  .chesstrx-match-hud-v3
  .timer::after {
    width: 27px;
  }

  .chesstrx-board-stage-v3 {
    padding:
      9px
      7px
      11px;

    border-radius: 23px;
  }

  .chesstrx-board-stage-v3
  .board-wrap {
    padding: 5px;
    border-radius: 18px;
  }

  .chesstrx-board-stage-v3
  #board,
  .chesstrx-board-stage-v3
  .board {
    border-radius:
      13px !important;
  }
}

@media (max-width: 350px) {
  .chesstrx-player-emblem-v3 {
    display: none;
  }

  .chesstrx-match-hud-v3
  .player-box {
    display: block !important;
    padding:
      11px
      6px !important;

    text-align: center !important;
  }

  .chesstrx-match-hud-v3
  .player-title,
  .chesstrx-match-hud-v3
  .player-id,
  .chesstrx-match-hud-v3
  .player-balance {
    display: block;
    text-align: center;
  }
}

/* =========================================================
   CHESSTRX — AVATARES TELEGRAM V1
========================================================= */

.chesstrx-player-emblem-v3 {
  position: relative;
  overflow: hidden;
  padding: 0 !important;
  isolation: isolate;
}

.chesstrx-player-emblem-v3.has-telegram-photo-v1 {
  border-color:
    rgba(0, 234, 255, 0.72) !important;

  background:
    rgba(0, 234, 255, 0.08) !important;

  box-shadow:
    0 0 0 2px rgba(0, 234, 255, 0.10),
    0 0 19px rgba(0, 234, 255, 0.32) !important;
}

.player-rival-v3
.chesstrx-player-emblem-v3.has-telegram-photo-v1 {
  border-color:
    rgba(245, 200, 91, 0.72) !important;

  box-shadow:
    0 0 0 2px rgba(245, 200, 91, 0.10),
    0 0 19px rgba(245, 200, 91, 0.28) !important;
}

.chesstrx-player-emblem-v3
.chesstrx-telegram-avatar-v1 {
  display: block;
  width: 100%;
  height: 100%;

  object-fit: cover;
  object-position: center;

  border-radius: inherit;

  opacity: 0;
  transform: scale(1.08);

  transition:
    opacity 0.24s ease,
    transform 0.30s ease;
}

.chesstrx-player-emblem-v3
.chesstrx-telegram-avatar-v1.is-loaded {
  opacity: 1;
  transform: scale(1);
}

.chesstrx-player-emblem-v3.has-telegram-photo-v1::after {
  content: "";

  position: absolute;
  inset: 0;
  z-index: 2;

  pointer-events: none;
  border-radius: inherit;

  box-shadow:
    inset 0 0 0 1px
    rgba(255, 255, 255, 0.16);
}

/* === FIN CHESSTRX AVATARES TELEGRAM V1 === */

/* === CHESSTRX LOWER UI FINAL V1 === */

/*
 * Zona inferior moderna y definitiva.
 * No modifica la lógica del juego.
 */

:root {
  --lower-v1-panel:
    linear-gradient(
      150deg,
      rgba(8, 31, 51, 0.97),
      rgba(2, 14, 27, 0.98)
    );

  --lower-v1-panel-soft:
    linear-gradient(
      145deg,
      rgba(13, 44, 68, 0.88),
      rgba(4, 21, 38, 0.94)
    );

  --lower-v1-border:
    rgba(28, 220, 239, 0.35);

  --lower-v1-border-soft:
    rgba(28, 220, 239, 0.18);

  --lower-v1-cyan:
    #19e6f2;

  --lower-v1-cyan-soft:
    #78f6ff;

  --lower-v1-gold:
    #f4cc68;

  --lower-v1-gold-light:
    #fff0a5;

  --lower-v1-green:
    #65ff40;

  --lower-v1-red:
    #ff5e6d;

  --lower-v1-text:
    #edf8ff;

  --lower-v1-muted:
    #91a6b8;
}


/* =========================================================
   ESPACIADO GENERAL DE LA ZONA INFERIOR
========================================================= */

.app {
  padding-bottom:
    calc(
      30px +
      env(safe-area-inset-bottom)
    ) !important;
}


/* =========================================================
   CONTENEDOR DE APUESTAS Y ACCIONES
========================================================= */

.chesstrx-action-dock-v3,
.controls {
  position: relative;
  display: grid !important;
  grid-template-columns:
    minmax(0, 0.92fr)
    minmax(150px, 1.08fr);
  align-items: stretch;
  gap: 13px !important;
  width: 100%;
  margin:
    20px 0
    12px !important;
  padding:
    18px !important;
  border:
    1px solid
    rgba(28, 220, 239, 0.27) !important;
  border-radius:
    25px !important;
  background:
    linear-gradient(
      145deg,
      rgba(7, 31, 51, 0.96),
      rgba(2, 16, 30, 0.99)
    ) !important;
  box-shadow:
    0 18px 42px
      rgba(0, 0, 0, 0.30),
    inset 0 1px 0
      rgba(255, 255, 255, 0.05),
    0 0 28px
      rgba(0, 218, 237, 0.06) !important;
  overflow:
    visible !important;
  isolation:
    isolate;
}

.chesstrx-action-dock-v3::before,
.controls::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 7%;
  width: 42%;
  height: 2px;
  z-index: 2;
  border-radius: 999px;
  background:
    linear-gradient(
      90deg,
      transparent,
      #1ce6f3,
      #8cf8ff,
      transparent
    );
  opacity: 0.82;
}

.chesstrx-action-dock-v3::after,
.controls::after {
  content: "";
  position: absolute;
  right: 5%;
  bottom: -1px;
  width: 25%;
  height: 2px;
  z-index: 2;
  border-radius: 999px;
  background:
    linear-gradient(
      90deg,
      transparent,
      rgba(244, 204, 104, 0.88),
      transparent
    );
}


/* =========================================================
   CAMPO DE APUESTA
========================================================= */

#entryFee {
  box-sizing:
    border-box !important;
  width:
    100% !important;
  min-width:
    0 !important;
  min-height:
    61px !important;
  margin:
    0 !important;
  padding:
    13px 18px !important;
  color:
    #ffffff !important;
  font-size:
    20px !important;
  font-weight:
    850 !important;
  line-height:
    1.1 !important;
  text-align:
    center !important;
  outline:
    none !important;
  border:
    1px solid
    rgba(28, 220, 239, 0.20) !important;
  border-radius:
    18px !important;
  background:
    linear-gradient(
      145deg,
      rgba(0, 9, 22, 0.92),
      rgba(3, 20, 34, 0.88)
    ) !important;
  box-shadow:
    inset 0 0 20px
      rgba(0, 0, 0, 0.27),
    0 9px 22px
      rgba(0, 0, 0, 0.18) !important;
  transition:
    border-color 0.20s ease,
    box-shadow 0.20s ease,
    transform 0.20s ease !important;
  appearance:
    textfield;
}

#entryFee:focus {
  border-color:
    rgba(34, 235, 247, 0.76) !important;
  box-shadow:
    inset 0 0 20px
      rgba(0, 0, 0, 0.26),
    0 0 0 3px
      rgba(24, 229, 242, 0.10),
    0 0 24px
      rgba(24, 229, 242, 0.13) !important;
  transform:
    translateY(-1px);
}

#entryFee::placeholder {
  color:
    rgba(190, 211, 226, 0.60) !important;
  font-size:
    15px !important;
  font-weight:
    650 !important;
}

#entryFee::-webkit-outer-spin-button,
#entryFee::-webkit-inner-spin-button {
  margin:
    0;
  appearance:
    none;
}


/* =========================================================
   BOTÓN CREAR APUESTA
========================================================= */

#createBetBtn {
  box-sizing:
    border-box !important;
  width:
    100% !important;
  min-width:
    0 !important;
  min-height:
    61px !important;
  margin:
    0 !important;
  padding:
    13px 16px !important;
  color:
    #15130e !important;
  font-size:
    17px !important;
  font-weight:
    900 !important;
  line-height:
    1.15 !important;
  border:
    1px solid
    rgba(255, 235, 158, 0.62) !important;
  border-radius:
    18px !important;
  background:
    linear-gradient(
      135deg,
      #fff0a3 0%,
      #f3ce6f 44%,
      #e6b944 100%
    ) !important;
  box-shadow:
    0 13px 26px
      rgba(228, 179, 57, 0.19),
    inset 0 1px 0
      rgba(255, 255, 255, 0.72) !important;
  text-shadow:
    0 1px 0
      rgba(255, 255, 255, 0.35);
  transition:
    transform 0.16s ease,
    filter 0.16s ease,
    box-shadow 0.16s ease !important;
  -webkit-tap-highlight-color:
    transparent;
}

#createBetBtn:active {
  transform:
    scale(0.975) !important;
  filter:
    brightness(0.95);
}

#createBetBtn:disabled {
  color:
    rgba(20, 20, 20, 0.65) !important;
  cursor:
    not-allowed !important;
  filter:
    grayscale(0.28)
    brightness(0.82) !important;
  box-shadow:
    none !important;
}


/* =========================================================
   BOTONES SECUNDARIOS
========================================================= */

#cancelOfferBtn,
#findBtn,
#resignBtn {
  box-sizing:
    border-box !important;
  width:
    100% !important;
  min-height:
    54px !important;
  margin:
    0 !important;
  padding:
    12px 16px !important;
  font-size:
    15px !important;
  font-weight:
    850 !important;
  border-radius:
    16px !important;
  transition:
    transform 0.16s ease,
    filter 0.16s ease !important;
}

#cancelOfferBtn {
  grid-column:
    1 / -1;
  color:
    #ffd8dc !important;
  border:
    1px solid
    rgba(255, 87, 105, 0.38) !important;
  background:
    linear-gradient(
      135deg,
      rgba(104, 19, 35, 0.91),
      rgba(52, 11, 24, 0.96)
    ) !important;
  box-shadow:
    0 10px 24px
      rgba(90, 7, 24, 0.20) !important;
}

#findBtn {
  grid-column:
    1 / -1;
  color:
    #031217 !important;
  border:
    1px solid
    rgba(129, 250, 255, 0.48) !important;
  background:
    linear-gradient(
      135deg,
      #8bfaff,
      #16d9eb
    ) !important;
}

#resignBtn {
  grid-column:
    1 / -1;
  color:
    #ffffff !important;
  border:
    1px solid
    rgba(255, 100, 113, 0.44) !important;
  background:
    linear-gradient(
      135deg,
      #d7384a,
      #8f1729
    ) !important;
  box-shadow:
    0 10px 24px
      rgba(153, 17, 37, 0.24) !important;
}

#cancelOfferBtn:active,
#findBtn:active,
#resignBtn:active {
  transform:
    scale(0.975) !important;
  filter:
    brightness(0.94);
}


/* =========================================================
   TARJETAS INFERIORES GENERALES
========================================================= */

#dghLobbyPanel,
.moves,
.stats,
#chessRankingPanel,
.ranking-panel {
  position:
    relative !important;
  box-sizing:
    border-box !important;
  width:
    100% !important;
  margin:
    18px 0 0 !important;
  padding:
    22px 20px !important;
  color:
    var(--lower-v1-text) !important;
  border:
    1px solid
    var(--lower-v1-border) !important;
  border-radius:
    25px !important;
  background:
    var(--lower-v1-panel) !important;
  box-shadow:
    0 17px 40px
      rgba(0, 0, 0, 0.27),
    inset 0 1px 0
      rgba(255, 255, 255, 0.04),
    0 0 26px
      rgba(0, 224, 239, 0.045) !important;
}

#dghLobbyPanel::before,
.moves::before,
.stats::before,
#chessRankingPanel::before,
.ranking-panel::before {
  content:
    "";
  position:
    absolute;
  top:
    -1px;
  left:
    7%;
  width:
    38%;
  height:
    2px;
  border-radius:
    999px;
  background:
    linear-gradient(
      90deg,
      transparent,
      rgba(25, 230, 242, 0.88),
      rgba(132, 248, 255, 0.72),
      transparent
    );
}

#dghLobbyPanel > b:first-child,
.moves > b:first-child,
.stats > b:first-child {
  display:
    inline-block;
  margin-bottom:
    9px;
  color:
    #f2f8ff !important;
  font-size:
    18px !important;
  font-weight:
    900 !important;
  letter-spacing:
    -0.2px;
}


/* =========================================================
   LISTA DE JUGADORES DISPONIBLES
========================================================= */

#dghLobbyPanel {
  max-height:
    min(54vh, 480px) !important;
  min-height:
    118px;
  overflow-x:
    hidden !important;
  overflow-y:
    auto !important;
  overscroll-behavior:
    contain !important;
  touch-action:
    pan-y !important;
  -webkit-overflow-scrolling:
    touch !important;
  scrollbar-width:
    thin;
  scrollbar-color:
    rgba(28, 220, 239, 0.65)
    rgba(0, 13, 25, 0.48);
}

#dghLobbyPanel::-webkit-scrollbar {
  width:
    7px;
}

#dghLobbyPanel::-webkit-scrollbar-track {
  border-radius:
    999px;
  background:
    rgba(0, 13, 25, 0.44);
}

#dghLobbyPanel::-webkit-scrollbar-thumb {
  border-radius:
    999px;
  background:
    linear-gradient(
      180deg,
      rgba(35, 234, 245, 0.84),
      rgba(13, 143, 167, 0.78)
    );
}

#dghLobbyPanel .available-player-card {
  position:
    relative;
  display:
    block;
  box-sizing:
    border-box;
  width:
    100%;
  min-width:
    0;
  margin:
    16px 0 0 !important;
  padding:
    17px 16px 16px !important;
  color:
    #dcecf7 !important;
  font-size:
    15px !important;
  line-height:
    1.65 !important;
  border:
    1px solid
    rgba(25, 220, 237, 0.25) !important;
  border-radius:
    20px !important;
  background:
    linear-gradient(
      145deg,
      rgba(12, 42, 65, 0.82),
      rgba(3, 20, 36, 0.93)
    ) !important;
  box-shadow:
    0 11px 27px
      rgba(0, 0, 0, 0.20),
    inset 0 1px 0
      rgba(255, 255, 255, 0.035) !important;
  overflow:
    visible !important;
  word-break:
    break-word;
}

#dghLobbyPanel
.available-player-card::before {
  content:
    "";
  position:
    absolute;
  top:
    13px;
  right:
    14px;
  width:
    8px;
  height:
    8px;
  border-radius:
    50%;
  background:
    #65ff40;
  box-shadow:
    0 0 12px
      rgba(101, 255, 64, 0.80);
}

#dghLobbyPanel
.available-player-card > b:first-child {
  display:
    block;
  max-width:
    calc(100% - 24px);
  margin-bottom:
    5px;
  overflow:
    hidden;
  color:
    #f4fbff !important;
  font-size:
    18px !important;
  font-weight:
    850 !important;
  line-height:
    1.25;
  text-overflow:
    ellipsis;
  white-space:
    nowrap;
}

#dghLobbyPanel .safe-accept-offer {
  display:
    block !important;
  box-sizing:
    border-box !important;
  width:
    100% !important;
  min-height:
    52px !important;
  margin:
    15px 0 2px !important;
  padding:
    12px 16px !important;
  color:
    #071217 !important;
  font-size:
    16px !important;
  font-weight:
    900 !important;
  line-height:
    1.15 !important;
  border:
    1px solid
    rgba(133, 250, 255, 0.56) !important;
  border-radius:
    15px !important;
  background:
    linear-gradient(
      135deg,
      #91fbff 0%,
      #26e5f1 48%,
      #0fc0d5 100%
    ) !important;
  box-shadow:
    0 11px 24px
      rgba(9, 196, 217, 0.18),
    inset 0 1px 0
      rgba(255, 255, 255, 0.70) !important;
  transition:
    transform 0.15s ease,
    filter 0.15s ease !important;
  -webkit-tap-highlight-color:
    transparent;
}

#dghLobbyPanel
.safe-accept-offer:active {
  transform:
    scale(0.975) !important;
  filter:
    brightness(0.94);
}

#dghLobbyPanel
.safe-accept-offer:disabled {
  color:
    rgba(4, 21, 27, 0.65) !important;
  filter:
    grayscale(0.42)
    brightness(0.77);
  cursor:
    not-allowed;
}


/* =========================================================
   HISTORIAL
========================================================= */

.moves {
  min-height:
    126px;
  max-height:
    275px !important;
  overflow-x:
    hidden !important;
  overflow-y:
    auto !important;
  overscroll-behavior:
    contain;
  touch-action:
    pan-y;
  -webkit-overflow-scrolling:
    touch;
  color:
    #cbdbe7 !important;
  font-size:
    15px !important;
  line-height:
    1.62 !important;
  scrollbar-width:
    thin;
  scrollbar-color:
    rgba(28, 220, 239, 0.55)
    transparent;
}

.moves::-webkit-scrollbar {
  width:
    6px;
}

.moves::-webkit-scrollbar-thumb {
  border-radius:
    999px;
  background:
    rgba(28, 220, 239, 0.52);
}


/* =========================================================
   ESTADÍSTICAS
========================================================= */

.stats {
  min-height:
    150px;
  max-height:
    none !important;
  overflow:
    hidden !important;
  color:
    #d7e6f0 !important;
  font-size:
    16px !important;
  line-height:
    1.63 !important;
  background:
    linear-gradient(
      145deg,
      rgba(6, 30, 49, 0.97),
      rgba(2, 16, 29, 0.99)
    ) !important;
}

.stats b {
  color:
    #f6fbff !important;
}


/* =========================================================
   RANKING
========================================================= */

#chessRankingPanel,
.ranking-panel {
  padding:
    20px !important;
  overflow:
    hidden !important;
}

.ranking-toggle {
  box-sizing:
    border-box !important;
  width:
    100% !important;
  min-height:
    58px !important;
  margin:
    0 !important;
  padding:
    14px 18px !important;
  color:
    #18140b !important;
  font-size:
    18px !important;
  font-weight:
    900 !important;
  border:
    1px solid
    rgba(255, 238, 169, 0.65) !important;
  border-radius:
    17px !important;
  background:
    linear-gradient(
      135deg,
      #fff0a5 0%,
      #f3cd68 48%,
      #e8b840 100%
    ) !important;
  box-shadow:
    0 12px 28px
      rgba(228, 178, 51, 0.18),
    inset 0 1px 0
      rgba(255, 255, 255, 0.72) !important;
}

.ranking-toggle:active {
  transform:
    scale(0.98);
}

.ranking-body {
  margin-top:
    18px !important;
  padding-top:
    17px;
  border-top:
    1px solid
    rgba(28, 220, 239, 0.14);
}

.ranking-personal {
  margin:
    0 0 15px !important;
  padding:
    14px !important;
  color:
    #d8edf7 !important;
  border:
    1px solid
    rgba(28, 220, 239, 0.18) !important;
  border-radius:
    15px !important;
  background:
    rgba(7, 36, 56, 0.64) !important;
}

.ranking-header-row,
.ranking-player-row {
  display:
    grid !important;
  grid-template-columns:
    45px
    minmax(0, 1fr)
    65px
    52px !important;
  align-items:
    center;
  gap:
    8px !important;
  min-width:
    0;
}

.ranking-header-row {
  margin-bottom:
    8px;
  padding:
    0 9px 8px !important;
  color:
    #7893a7 !important;
  font-size:
    10px !important;
  font-weight:
    800 !important;
  letter-spacing:
    0.7px;
  text-transform:
    uppercase;
  border-bottom:
    1px solid
    rgba(28, 220, 239, 0.12);
}

.ranking-player-row {
  margin:
    7px 0 !important;
  padding:
    12px 9px !important;
  color:
    #dfeef8 !important;
  border:
    1px solid
    rgba(28, 220, 239, 0.12) !important;
  border-radius:
    14px !important;
  background:
    rgba(6, 31, 49, 0.67) !important;
}

.ranking-player-row.current-player {
  border-color:
    rgba(244, 204, 104, 0.55) !important;
  background:
    linear-gradient(
      135deg,
      rgba(91, 69, 17, 0.34),
      rgba(8, 39, 57, 0.82)
    ) !important;
  box-shadow:
    inset 3px 0 0
      rgba(244, 204, 104, 0.88);
}

.ranking-position {
  color:
    var(--lower-v1-gold) !important;
  font-weight:
    900 !important;
}

.ranking-name {
  min-width:
    0;
  overflow:
    hidden;
  color:
    #edf8ff !important;
  font-size:
    13px !important;
  font-weight:
    750 !important;
  text-overflow:
    ellipsis;
  white-space:
    nowrap;
}

.ranking-elo {
  color:
    var(--lower-v1-cyan-soft) !important;
  font-weight:
    850 !important;
  text-align:
    center;
}

.ranking-wins {
  color:
    #dcecf7 !important;
  font-weight:
    800 !important;
  text-align:
    center;
}

.ranking-pagination {
  display:
    grid !important;
  grid-template-columns:
    1fr auto 1fr;
  align-items:
    center;
  gap:
    10px !important;
  margin-top:
    15px !important;
}

.ranking-pagination button,
.ranking-refresh {
  min-height:
    46px !important;
  margin:
    0 !important;
  color:
    #dffcff !important;
  font-weight:
    850 !important;
  border:
    1px solid
    rgba(28, 220, 239, 0.28) !important;
  border-radius:
    13px !important;
  background:
    rgba(10, 55, 74, 0.65) !important;
  box-shadow:
    none !important;
}

.ranking-pagination button:disabled {
  opacity:
    0.35;
}

.ranking-page-info {
  color:
    #93a9b9 !important;
  font-size:
    12px !important;
  font-weight:
    750 !important;
  white-space:
    nowrap;
}

.ranking-refresh {
  width:
    100% !important;
  margin-top:
    12px !important;
}

.ranking-empty,
.ranking-loading,
.ranking-error {
  padding:
    18px 10px !important;
  color:
    #a9bbc9 !important;
  line-height:
    1.55;
  text-align:
    center;
}

.ranking-error {
  color:
    #ffabb3 !important;
}


/* =========================================================
   PIE DE PÁGINA
========================================================= */

.footer {
  position:
    relative;
  margin:
    25px 0 0 !important;
  padding:
    21px 15px
    calc(
      18px +
      env(safe-area-inset-bottom)
    ) !important;
  color:
    #8497a7 !important;
  font-size:
    13px !important;
  font-weight:
    650 !important;
  letter-spacing:
    0.2px;
  text-align:
    center;
  border-top:
    1px solid
    rgba(28, 220, 239, 0.12);
}

.footer::before {
  content:
    "";
  position:
    absolute;
  top:
    -1px;
  left:
    50%;
  width:
    92px;
  height:
    2px;
  border-radius:
    999px;
  background:
    linear-gradient(
      90deg,
      transparent,
      rgba(25, 230, 242, 0.72),
      transparent
    );
  transform:
    translateX(-50%);
}


/* =========================================================
   TELÉFONOS
========================================================= */

@media (max-width: 430px) {
  .chesstrx-action-dock-v3,
  .controls {
    grid-template-columns:
      minmax(0, 0.88fr)
      minmax(145px, 1.12fr);
    gap:
      10px !important;
    padding:
      15px !important;
    border-radius:
      22px !important;
  }

  #entryFee {
    min-height:
      58px !important;
    padding:
      11px 10px !important;
    font-size:
      19px !important;
  }

  #createBetBtn {
    min-height:
      58px !important;
    padding:
      11px 10px !important;
    font-size:
      15px !important;
  }

  #dghLobbyPanel,
  .moves,
  .stats,
  #chessRankingPanel,
  .ranking-panel {
    padding:
      19px 16px !important;
    border-radius:
      22px !important;
  }

  #dghLobbyPanel {
    max-height:
      min(56vh, 455px) !important;
    padding-bottom:
      calc(
        30px +
        env(safe-area-inset-bottom)
      ) !important;
  }

  #dghLobbyPanel
  .available-player-card {
    padding:
      16px 14px !important;
    font-size:
      14px !important;
  }

  .ranking-header-row,
  .ranking-player-row {
    grid-template-columns:
      40px
      minmax(0, 1fr)
      59px
      45px !important;
    gap:
      6px !important;
  }

  .ranking-name {
    font-size:
      12px !important;
  }

  .ranking-elo,
  .ranking-wins {
    font-size:
      12px !important;
  }
}


/* =========================================================
   TELÉFONOS MUY PEQUEÑOS
========================================================= */

@media (max-width: 350px) {
  .chesstrx-action-dock-v3,
  .controls {
    grid-template-columns:
      1fr !important;
  }

  #entryFee,
  #createBetBtn,
  #cancelOfferBtn,
  #findBtn,
  #resignBtn {
    grid-column:
      1 / -1 !important;
  }

  .ranking-header-row,
  .ranking-player-row {
    grid-template-columns:
      35px
      minmax(0, 1fr)
      53px
      41px !important;
    padding-left:
      6px !important;
    padding-right:
      6px !important;
  }
}


/* =========================================================
   ACCESIBILIDAD
========================================================= */

@media (prefers-reduced-motion: reduce) {
  #entryFee,
  #createBetBtn,
  #cancelOfferBtn,
  #findBtn,
  #resignBtn,
  .ranking-toggle,
  .safe-accept-offer {
    transition:
      none !important;
  }
}

/* === FIN CHESSTRX LOWER UI FINAL V1 === */
