/* =========================================================
   A11 — STYLES.CSS
   BACKGAMMON PUCARÁ

   ETAPA:
   Interfaz funcional provisional.

   Objetivo:
   - Tablero completo visible.
   - Landscape responsive.
   - 24 puntos.
   - Barra central.
   - Fichas visibles.
   - Dados visibles.
   - Zonas de retirada.
   - Sin scroll.
   - Preparado para reemplazar CSS por assets premium.
========================================================= */


/* =========================================================
   A11.1 — RESET
========================================================= */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}


html,
body {
  width: 100%;
  height: 100%;
  min-height: 100%;
}


html {
  background: #050806;
}


body {
  overflow: hidden;

  font-family:
    Arial,
    Helvetica,
    sans-serif;

  background:
    radial-gradient(
      circle at center,
      #183025 0%,
      #09140f 58%,
      #030604 100%
    );

  color: #f4ead0;

  overscroll-behavior: none;

  -webkit-user-select: none;
  user-select: none;

  -webkit-touch-callout: none;
}


button {
  font: inherit;

  -webkit-tap-highlight-color:
    transparent;

  touch-action:
    manipulation;
}


/* =========================================================
   A11.2 — ROOT
========================================================= */

.game-root {
  width: 100%;
  height: 100dvh;

  min-width: 0;
  min-height: 0;

  overflow: hidden;
}


/* =========================================================
   A11.3 — JUEGO
========================================================= */

.backgammon-game {
  width: 100%;
  height: 100%;

  display: grid;

  grid-template-rows:
    auto
    minmax(0, 1fr)
    auto;

  gap: 6px;

  padding:
    max(5px, env(safe-area-inset-top))
    max(6px, env(safe-area-inset-right))
    max(5px, env(safe-area-inset-bottom))
    max(6px, env(safe-area-inset-left));
}


/* =========================================================
   A11.4 — HEADER
========================================================= */

.game-header {
  min-height: 42px;

  display: grid;

  grid-template-columns:
    minmax(120px, 1fr)
    auto
    minmax(120px, 1fr);

  align-items: center;

  gap: 10px;

  padding:
    5px
    10px;

  border:
    1px solid
    rgba(214, 177, 92, 0.45);

  border-radius:
    10px;

  background:
    linear-gradient(
      180deg,
      rgba(18, 27, 22, 0.96),
      rgba(5, 11, 8, 0.96)
    );

  box-shadow:
    0 4px 14px
    rgba(0, 0, 0, 0.35);
}


.game-brand {
  display: flex;

  align-items: baseline;

  gap: 7px;

  white-space: nowrap;
}


.game-brand strong {
  font-size: 15px;

  letter-spacing:
    0.08em;

  color: #e5c473;
}


.game-brand span {
  font-size: 10px;

  letter-spacing:
    0.18em;

  color:
    rgba(255, 255, 255, 0.68);
}


/* =========================================================
   A11.5 — INDICADOR DE TURNO
========================================================= */

.turn-indicator {
  min-width: 150px;

  min-height: 30px;

  display: flex;

  justify-content: center;
  align-items: center;

  gap: 7px;

  padding:
    4px
    12px;

  border-radius:
    999px;

  border:
    1px solid
    rgba(255, 255, 255, 0.12);

  background:
    rgba(73, 73, 73, 0.32);
}


.turn-player {
  font-size: 12px;

  color: #f7e8ba;
}


.turn-status {
  font-size: 9px;

  letter-spacing:
    0.08em;

  color:
    rgba(255, 255, 255, 0.62);
}


.turn-indicator--player {
  border-color:
    rgba(230, 189, 143, 0.42);
}


.turn-indicator--cpu {
  border-color:
    rgba(120, 120, 120, 0.55);
}


.turn-indicator--finished {
  border-color:
    rgba(218, 178, 75, 0.75);

  box-shadow:
    0 0 12px
    rgba(218, 178, 75, 0.18);
}


/* =========================================================
   A11.6 — BOTÓN HEADER
========================================================= */

.header-button {
  justify-self: end;

  min-height: 30px;

  padding:
    5px
    12px;

  border:
    1px solid
    rgba(216, 177, 87, 0.55);

  border-radius:
    7px;

  background:
    linear-gradient(
      180deg,
      #29251c,
      #11100d
    );

  color: #ead49b;

  font-size: 11px;

  cursor: pointer;
}


.header-button:active {
  transform:
    translateY(1px);
}

/* =========================================================
   A17 — TABLERO PREMIUM
   La imagen es SOLO visual.
   La grilla lógica permanece encima.
========================================================= */

.backgammon-table {
  width:
    min(100%, 1120px);

  height: 100%;

  min-height: 0;

  justify-self: center;

  display: grid;

  /*
   * Mantenemos exactamente las 5 zonas lógicas:
   *
   * retirada CPU
   * tablero izquierdo
   * barra
   * tablero derecho
   * retirada jugador
   */
  grid-template-columns:
    34px
    minmax(0, 1fr)
    clamp(46px, 6vw, 68px)
    minmax(0, 1fr)
    34px;

  position: relative;

  overflow: hidden;

  border: 0;

  border-radius:
    12px;

  background-image:
    url("assets/tablero backgamon.webp");

  background-repeat:
    no-repeat;

  background-position:
    center center;

  background-size:
    100% 100%;

  box-shadow:
    0 12px 28px
    rgba(0, 0, 0, 0.58);
}


/* =========================================================
   A18 — MITADES LÓGICAS TRANSPARENTES
========================================================= */

.board-half {
  min-width: 0;
  min-height: 0;

  display: grid;

  grid-template-rows:
    minmax(0, 1fr)
    minmax(0, 1fr);

  background:
    transparent;

  overflow: hidden;
}

.board-half--left {
  border-right: 0;
}

.board-half--right {
  border-left: 0;
}

/* =========================================================
   A11.9 — FILAS DE PUNTOS
========================================================= */

.points-row {
  min-height: 0;

  display: grid;

  grid-template-columns:
    repeat(6, minmax(0, 1fr));

  position: relative;

  overflow: hidden;
}


.points-row--top {
  align-items: start;
}


.points-row--bottom {
  align-items: end;
}


/* =========================================================
   A11.10 — PUNTO / TRIÁNGULO
========================================================= */

.board-point {
  width: 100%;
  height: 100%;

  min-width: 0;
  min-height: 0;

  position: relative;

  display: flex;

  justify-content: center;

  border: 0;

  padding: 0;

  background: transparent;

  cursor: default;

  overflow: hidden;
}

/* =========================================================
   A19 — EL ASSET YA TRAE LOS 24 TRIÁNGULOS
========================================================= */

.board-point::before {
  opacity: 0;
}
/* =========================================================
   A11.11 — TRIÁNGULOS
========================================================= */

.board-point::before {
  content: "";

  position: absolute;

  left: 4%;
  right: 4%;

  width: 92%;

  height: 88%;

  margin: auto;

  pointer-events: none;

  opacity: 0.95;
}


.board-point--top::before {
  top: 0;

  clip-path:
    polygon(
      0 0,
      100% 0,
      50% 100%
    );
}


.board-point--bottom::before {
  bottom: 0;

  clip-path:
    polygon(
      50% 0,
      100% 100%,
      0 100%
    );
}


.board-point--light::before {
  background:
    linear-gradient(
      180deg,
      #d5b06c,
      #a97c42
    );
}


.board-point--dark::before {
  background:
    linear-gradient(
      180deg,
      #61301f,
      #3b1c15
    );
}


/* =========================================================
   A11.12 — NÚMERO DEL PUNTO
========================================================= */

.point-number {
  position: absolute;

  z-index: 5;

  left: 50%;

  transform:
    translateX(-50%);

  font-size:
    clamp(7px, 1vw, 10px);

  font-weight: 700;

  color:
    rgba(255, 255, 255, 0.46);

  pointer-events: none;
}


.board-point--top
.point-number {
  top: 2px;
}


.board-point--bottom
.point-number {
  bottom: 2px;
}


/* =========================================================
   A11.13 — PILA DE FICHAS
========================================================= */

.checker-stack {
  position: absolute;

  z-index: 10;

  left: 50%;

  width: 92%;
  height: 100%;

  transform:
    translateX(-50%);

  display: flex;

  align-items: center;

  pointer-events: none;
}


.board-point--top
.checker-stack {
  top: 4px;

  flex-direction: column;

  justify-content: flex-start;
}


.board-point--bottom
.checker-stack {
  bottom: 4px;

  flex-direction: column-reverse;

  justify-content: flex-start;
}


/* =========================================================
   A11.14 — FICHA

   IMPORTANTE:
   tamaño limitado por ancho Y alto.

   Esto evita el problema de fichas montadas
   cuando Android tiene menos altura.
========================================================= */



/* =========================================================
   A11.15 — SOLAPAMIENTO CONTROLADO

   Cinco fichas deben entrar cómodamente.

   Si alguna posición llega a tener más fichas,
   se compactan visualmente.
========================================================= */

.checker +
.checker {
  margin-top:
    clamp(-7px, -0.9vh, -3px);
}


.board-point--bottom
.checker +
.checker {
  margin-top:
    clamp(-7px, -0.9vh, -3px);
}

/* =========================================================
   A13 — FICHA PREMIUM
========================================================= */

.checker {
  display: block;

  flex:
    0 0 auto;

  width:
    min(
      88%,
      clamp(22px, 5.2vh, 46px)
    );

  aspect-ratio:
    1 / 1;

  position: relative;

  border: 0;

  border-radius: 50%;

  background: transparent;

  box-shadow: none;

  pointer-events: none;
}


/* =========================================================
   IMAGEN REAL DE FICHA
========================================================= */

.checker-image {
  display: block;

  width: 100%;
  height: 100%;

  object-fit: contain;

  border: 0;

  border-radius: 50%;

  pointer-events: none;

  -webkit-user-drag: none;
  user-select: none;

  filter:
    drop-shadow(
      0
      2px
      3px
      rgba(0, 0, 0, 0.55)
    );
}


/* =========================================================
   JUGADOR — MARFIL
========================================================= */

.checker--player {
  background: transparent;
  border: 0;
  box-shadow: none;
}


/* =========================================================
   CPU — NEGRA
========================================================= */

.checker--cpu {
  background: transparent;
  border: 0;
  box-shadow: none;
}

/* =========================================================
   A11.18 — PUNTO SELECCIONABLE
========================================================= */

.board-point--selectable {
  cursor: pointer;
}


.board-point--selectable::after {
  content: "";

  position: absolute;

  z-index: 20;

  inset: 4px;

  border:
    2px solid
    rgba(255, 221, 117, 0.55);

  border-radius:
    5px;

  pointer-events: none;
}


/* =========================================================
   A11.19 — PUNTO SELECCIONADO
========================================================= */

.board-point--selected::after {
  content: "";

  position: absolute;

  z-index: 21;

  inset: 3px;

  border:
    2px solid
    #ffe17a;

  border-radius:
    5px;

  box-shadow:
    inset 0 0 12px
    rgba(255, 220, 92, 0.28),
    0 0 8px
    rgba(255, 220, 92, 0.3);

  pointer-events: none;
}


/* =========================================================
   A11.20 — DESTINO LEGAL
========================================================= */

.board-point--legal::after {
  content: "";

  position: absolute;

  z-index: 22;

  left: 50%;
  top: 50%;

  width:
    clamp(12px, 2.2vw, 22px);

  aspect-ratio:
    1 / 1;

  transform:
    translate(-50%, -50%);

  border-radius:
    50%;

  background:
    rgba(247, 222, 133, 0.8);

  box-shadow:
    0 0 10px
    rgba(247, 222, 133, 0.7);

  pointer-events: none;
}


/* =========================================================
   A11.21 — BARRA CENTRAL
========================================================= */

.bar {
  min-width: 0;
  min-height: 0;

  display: grid;

  grid-template-rows:
    minmax(0, 1fr)
    auto
    minmax(0, 1fr);

  gap: 4px;

  padding:
    5px 3px;

 background:
  transparent;

  border-left:
    1px solid
    rgba(0, 0, 0, 0.5);

  border-right:
    1px solid
    rgba(0, 0, 0, 0.5);
}


/* =========================================================
   A11.22 — ZONAS DE BARRA
========================================================= */

.bar-zone {
  min-height: 0;

  display: flex;

  align-items: center;

  overflow: hidden;
}


.bar-zone--cpu {
  flex-direction: column;

  justify-content: flex-start;
}


.bar-zone--player {
  flex-direction: column-reverse;

  justify-content: flex-start;
}


.bar-zone--selectable {
  cursor: pointer;

  background:
    rgba(255, 220, 110, 0.08);

  border-radius:
    6px;
}


.bar-zone--selected {
  box-shadow:
    inset 0 0 0 2px
    rgba(255, 222, 112, 0.65);

  border-radius:
    6px;
}


/* =========================================================
   A11.23 — FICHA EN BARRA
========================================================= */

.checker--bar {
  width:
    min(
      86%,
      clamp(22px, 5vh, 42px)
    );

  margin:
    0 auto;
}


.bar-zone
.checker +
.checker {
  margin-top:
    -10px;
}


/* =========================================================
   A11.24 — ÁREA DE DADOS
========================================================= */

.dice-area {
  min-height: 42px;

  display: flex;

  flex-wrap: wrap;

  justify-content: center;
  align-items: center;

  gap: 4px;

  padding:
    4px 2px;

  border-top:
    1px solid
    rgba(255, 255, 255, 0.08);

  border-bottom:
    1px solid
    rgba(0, 0, 0, 0.4);
}


.dice-placeholder {
  font-size: 9px;

  text-transform: uppercase;

  color:
    rgba(255, 255, 255, 0.42);
}

/* =========================================================
   A15 — DADO PREMIUM
========================================================= */

.die {
  width:
    clamp(22px, 4.4vh, 36px);

  aspect-ratio:
    1 / 1;

  display: inline-flex;

  justify-content: center;
  align-items: center;

  border: 0;

  border-radius: 6px;

  background: transparent;

  box-shadow: none;

  overflow: hidden;
}


.die-image {
  display: block;

  width: 100%;
  height: 100%;

  object-fit: contain;

  pointer-events: none;

  -webkit-user-drag: none;
  user-select: none;

  filter:
    drop-shadow(
      0
      2px
      3px
      rgba(0, 0, 0, 0.55)
    );
}


.die--remaining {
  opacity: 1;
}


.die--used {
  opacity: 0.22;

  filter:
    grayscale(0.85);
}

/* =========================================================
   A11.26 — RETIRADA
========================================================= */

.bear-off {
  min-width: 0;
  min-height: 0;

  position: relative;

  display: flex;

  flex-direction: column;

  align-items: center;

  overflow: hidden;

  background:
    linear-gradient(
      180deg,
      #28180e,
      #4a2d18,
      #28180e
    );
}


.bear-off--cpu {
  justify-content:
    flex-start;
}


.bear-off--player {
  justify-content:
    flex-end;

  cursor: pointer;
}


.bear-off-count {
  position: absolute;

  z-index: 30;

  left: 50%;
  top: 50%;

  transform:
    translate(-50%, -50%);

  font-size: 10px;

  font-weight: 800;

  color:
    rgba(255, 232, 170, 0.72);

  pointer-events: none;
}


.checker--borne-off {
  width: 70%;

  height:
    clamp(4px, 1vh, 8px);

  min-height: 4px;

  aspect-ratio: auto;

  border-radius:
    3px;

  margin:
    1px 0;
}


/* =========================================================
   A11.27 — CONTROLES INFERIORES
========================================================= */

.game-controls {
  min-height: 44px;

  display: grid;

  grid-template-columns:
    minmax(0, 1fr)
    auto
    minmax(0, 1fr);

  align-items: center;

  gap: 10px;

  padding:
    4px
    10px;

  border:
    1px solid
    rgba(216, 177, 87, 0.3);

  border-radius:
    9px;

  background:
    rgba(5, 10, 7, 0.88);
}


/* =========================================================
   A11.28 — MENSAJE
========================================================= */

.game-message {
  min-width: 0;

  font-size:
    clamp(10px, 1.4vw, 12px);

  color:
    rgba(255, 255, 255, 0.76);

  white-space: nowrap;

  overflow: hidden;

  text-overflow: ellipsis;
}


.game-message--success {
  color: #f0d475;
}


.game-message--warning {
  color: #e5b47c;
}


/* =========================================================
   A11.29 — BOTÓN TIRAR DADOS
========================================================= */

.roll-dice-button {
  min-width: 132px;

  min-height: 34px;

  padding:
    6px
    16px;

  border:
    1px solid
    rgba(220, 181, 91, 0.48);

  border-radius:
    8px;

  background:
    linear-gradient(
      180deg,
      #2d271c,
      #11100d
    );

  color:
    rgba(235, 214, 159, 0.45);

  font-size: 11px;

  font-weight: 700;

  letter-spacing:
    0.06em;
}


.roll-dice-button--active {
  color: #f2d98d;

  cursor: pointer;

  border-color:
    rgba(237, 197, 94, 0.85);

  box-shadow:
    0 0 10px
    rgba(215, 173, 69, 0.13);
}


.roll-dice-button:disabled {
  cursor: default;
}


/* =========================================================
   A11.30 — DADOS RESTANTES
========================================================= */

.remaining-dice {
  min-width: 0;

  display: flex;

  justify-content: flex-end;
  align-items: center;

  gap: 4px;
}


.remaining-dice-label {
  margin-right: 3px;

  font-size: 9px;

  color:
    rgba(255, 255, 255, 0.45);
}


.remaining-dice
.die {
  width:
    clamp(19px, 3.8vh, 30px);
}


/* =========================================================
   A11.31 — ERROR FATAL
========================================================= */

.fatal-error {
  width: 100%;
  height: 100%;

  display: flex;

  flex-direction: column;

  justify-content: center;
  align-items: center;

  gap: 10px;

  padding: 30px;

  text-align: center;

  background: #080b09;

  color: #e9d49a;
}


.fatal-error h1 {
  font-size: 24px;
}


.fatal-error p {
  color: #ddd;
}


.fatal-error small {
  max-width: 700px;

  color: #c49b83;
}


/* =========================================================
   A11.32 — LANDSCAPE DE POCA ALTURA
   ANDROID / TELÉFONOS

   Acá NO cambiamos las reglas ni geometría del motor.
   Solamente reducimos interfaz exterior.
========================================================= */

@media
(max-height: 650px)
and
(orientation: landscape) {

  .backgammon-game {
    gap: 3px;

    padding:
      max(2px, env(safe-area-inset-top))
      max(4px, env(safe-area-inset-right))
      max(2px, env(safe-area-inset-bottom))
      max(4px, env(safe-area-inset-left));
  }


  .game-header {
    min-height: 34px;

    padding:
      2px
      8px;
  }


  .game-brand strong {
    font-size: 12px;
  }


  .game-brand span {
    font-size: 8px;
  }


  .turn-indicator {
    min-height: 26px;

    min-width: 130px;

    padding:
      2px
      8px;
  }


  .turn-player {
    font-size: 10px;
  }


  .turn-status {
    font-size: 8px;
  }


  .header-button {
    min-height: 26px;

    padding:
      3px
      9px;

    font-size: 9px;
  }


  .backgammon-table {
    grid-template-columns:
      27px
      minmax(0, 1fr)
      clamp(42px, 6vw, 58px)
      minmax(0, 1fr)
      27px;

    border-width:
      4px;

    border-radius:
      8px;
  }


  .checker {
    width:
      min(
        86%,
        clamp(20px, 5.5vh, 38px)
      );
  }


  .checker +
  .checker {
    margin-top:
      clamp(-7px, -1vh, -3px);
  }


  .game-controls {
    min-height: 36px;

    padding:
      2px
      7px;
  }


  .roll-dice-button {
    min-height: 28px;

    min-width: 112px;

    padding:
      3px
      10px;

    font-size: 9px;
  }


  .game-message {
    font-size: 9px;
  }


  .die {
    width:
      clamp(20px, 4.8vh, 30px);

    border-radius:
      5px;
  }


  .dice-area {
    min-height: 34px;

    padding:
      2px;
  }

}


/* =========================================================
   A11.33 — PANTALLAS MUY ANGOSTAS
========================================================= */

@media
(max-width: 700px)
and
(orientation: landscape) {

  .game-header {
    grid-template-columns:
      1fr
      auto
      1fr;
  }


  .game-brand span {
    display: none;
  }


  .backgammon-table {
    width: 100%;

    grid-template-columns:
      24px
      minmax(0, 1fr)
      42px
      minmax(0, 1fr)
      24px;
  }


  .point-number {
    display: none;
  }


  .remaining-dice-label {
    display: none;
  }

}


/* =========================================================
   A11.34 — PORTRAIT

   Backgammon lo estamos preparando para landscape.
   Por ahora no agregamos pantalla de "girar dispositivo"
   porque eso conviene hacerlo después de probar el motor.
========================================================= */

@media
(orientation: portrait) {

  .game-header {
    grid-template-columns:
      1fr
      auto;

    grid-template-areas:
      "brand button"
      "turn turn";
  }


  .game-brand {
    grid-area: brand;
  }


  .turn-indicator {
    grid-area: turn;

    justify-self: center;
  }


  .header-button {
    grid-area: button;
  }


  .game-controls {
    grid-template-columns:
      1fr;

    justify-items: center;
  }


  .game-message {
    width: 100%;

    text-align: center;
  }


  .remaining-dice {
    justify-content: center;
  }

}
/* =========================================================
   A13 — DESTINO LEGAL DE RETIRADA
========================================================= */

.bear-off--player {
  cursor: pointer;
}


.bear-off--legal {
  background:
    linear-gradient(
      180deg,
      #493219,
      #765123,
      #493219
    );

  box-shadow:
    inset 0 0 0 2px
    #ffe17a,
    inset 0 0 18px
    rgba(255, 215, 90, 0.42),
    0 0 12px
    rgba(255, 215, 90, 0.25);
}


.bear-off--legal::after {
  content: "SACAR";

  position: absolute;

  left: 50%;
  top: 50%;

  transform:
    translate(-50%, -50%)
    rotate(-90deg);

  z-index: 40;

  color: #ffe49a;

  font-size: 9px;

  font-weight: 900;

  letter-spacing: 0.12em;

  pointer-events: none;
}
/* =========================================================
   A22 — BACKGAMMON PUCARÁ
   HUD FLOTANTE — PRIMERA PRUEBA

   NO TOCA:
   - motor
   - reglas
   - IA
   - fichas
   - dados
   - puntos 0–23
   - geometría del tablero

   PARA VOLVER ATRÁS:
   borrar únicamente este bloque.
========================================================= */


/* =========================================================
   A22.1 — CONTENEDOR GENERAL
========================================================= */

.backgammon-game {
  position: relative;

  display: block;

  width: 100%;
  height: 100dvh;

  padding: 4px;

  overflow: hidden;
}


/* =========================================================
   A22.2 — TABLERO

   Ocupa prácticamente toda la pantalla.
========================================================= */

/* =========================================================
   A22.2 — TABLERO COMPLETO
   HUD flotante sin comprimir el tablero
========================================================= */

.backgammon-table {
  position: absolute;

  top: 4px;
  bottom: 4px;

  left: 50%;

  width:
    min(
      calc(100% - 8px),
      1120px
    );

  height:
    calc(100% - 8px);

  max-width: 1120px;

  margin: 0;

  transform:
    translateX(-50%);

  z-index: 1;
}

/* =========================================================
   A22.3 — HEADER FLOTANTE

   Ya NO ocupa una fila.
========================================================= */

.game-header {
  position: absolute;

  top: 7px;
  left: 8px;
  right: 8px;

  z-index: 50;

  min-height: 0;
  height: 36px;

  display: grid;

  grid-template-columns:
    auto
    1fr
    auto;

  align-items: center;

  gap: 8px;

  padding: 0;

  border: 0;

  background: transparent;

  box-shadow: none;

  pointer-events: none;
}


/* =========================================================
   A22.4 — MARCA ARRIBA IZQUIERDA
========================================================= */

.game-brand {
  pointer-events: none;

  padding:
    5px
    9px;

  border:
    1px solid
    rgba(214, 177, 92, 0.55);

  border-radius:
    9px;

  background:
    rgba(4, 11, 8, 0.86);

  box-shadow:
    0 3px 8px
    rgba(0, 0, 0, 0.45);
}


.game-brand strong {
  font-size: 12px;
}


.game-brand span {
  font-size: 8px;
}


/* =========================================================
   A22.5 — TURNO / RIVAL ARRIBA CENTRO
========================================================= */

.turn-indicator {
  justify-self: center;

  min-width: 145px;
  min-height: 30px;

  padding:
    4px
    10px;

  border:
    1px solid
    rgba(214, 177, 92, 0.55);

  background:
    rgba(29, 76, 55, 0.88);

  box-shadow:
    0 3px 8px
    rgba(0, 0, 0, 0.45);

  pointer-events: none;
}


/* =========================================================
   A22.6 — NUEVA PARTIDA ARRIBA DERECHA
========================================================= */

.header-button {
  justify-self: end;

  min-height: 30px;

  padding:
    4px
    10px;

  background:
    rgba(4, 11, 8, 0.9);

  pointer-events: auto;
}


/* =========================================================
   A22.7 — BARRA INFERIOR PASA A SER FLOTANTE

   El contenedor NO ocupa una fila.
========================================================= */

.game-controls {
  position: absolute;

  left: 8px;
  right: 8px;
  bottom: 7px;

  z-index: 50;

  height: 40px;
  min-height: 0;

  display: grid;

  grid-template-columns:
    minmax(160px, 1fr)
    auto
    minmax(160px, 1fr);

  align-items: center;

  gap: 8px;

  padding: 0;

  border: 0;

  background: transparent;

  pointer-events: none;
}


/* =========================================================
   A22.8 — MENSAJE ABAJO IZQUIERDA
========================================================= */

.game-message {
  justify-self: start;

  max-width: 280px;

  padding:
    6px
    10px;

  border:
    1px solid
    rgba(214, 177, 92, 0.42);

  border-radius:
    9px;

  background:
    rgba(4, 11, 8, 0.88);

  box-shadow:
    0 3px 8px
    rgba(0, 0, 0, 0.42);

  font-size: 10px;

  pointer-events: none;
}


/* =========================================================
   A22.9 — TIRAR DADOS ABAJO CENTRO
========================================================= */

.roll-dice-button {
  justify-self: center;

  min-width: 125px;
  min-height: 32px;

  padding:
    5px
    12px;

  background:
    rgba(4, 11, 8, 0.92);

  pointer-events: auto;
}


/* =========================================================
   A22.10 — DADOS DISPONIBLES ABAJO DERECHA
========================================================= */

.remaining-dice {
  justify-self: end;

  min-height: 32px;

  padding:
    3px
    6px;

  border:
    1px solid
    rgba(214, 177, 92, 0.42);

  border-radius:
    9px;

  background:
    rgba(4, 11, 8, 0.88);

  box-shadow:
    0 3px 8px
    rgba(0, 0, 0, 0.42);

  pointer-events: none;
}


.remaining-dice .die {
  width:
    clamp(23px, 4.4vh, 32px);
}


/* =========================================================
   A22.11 — ANDROID LANDSCAPE

   Compactamos solamente HUD flotante.
   El tablero sigue ocupando la pantalla.
========================================================= */

@media
(max-height: 650px)
and
(orientation: landscape) {

  .game-header {
    top: 5px;
    left: 6px;
    right: 6px;

    height: 30px;
  }


  .game-brand {
    padding:
      3px
      7px;
  }


  .game-brand strong {
    font-size: 10px;
  }


  .game-brand span {
    display: none;
  }


  .turn-indicator {
    min-width: 125px;
    min-height: 26px;

    padding:
      2px
      8px;
  }


  .header-button {
    min-height: 26px;

    padding:
      3px
      8px;

    font-size: 9px;
  }


  .game-controls {
    left: 6px;
    right: 6px;
    bottom: 5px;

    height: 34px;
  }


  .game-message {
    padding:
      4px
      7px;

    font-size: 9px;
  }


  .roll-dice-button {
    min-width: 108px;
    min-height: 28px;

    padding:
      3px
      8px;

    font-size: 9px;
  }


  .remaining-dice {
    min-height: 28px;

    padding:
      2px
      5px;
  }

}
/* =========================================================
   A23 — BACKGAMMON PUCARÁ
   HUD FLOTANTE PREMIUM

   SOLO PRESENTACIÓN.
   NO modifica motor ni tablero.
========================================================= */


/* =========================================================
   A23.1 — MARCA SUPERIOR IZQUIERDA
========================================================= */

.game-brand {
  min-width: 145px;

  display: flex;
  align-items: center;

  gap: 6px;

  padding:
    6px
    12px;

  border:
    1px solid
    rgba(218, 177, 77, 0.68);

  border-radius:
    10px;

  background:
    linear-gradient(
      180deg,
      rgba(20, 24, 18, 0.96),
      rgba(5, 10, 7, 0.94)
    );

  box-shadow:
    inset 0 0 0 1px
    rgba(255, 221, 130, 0.08),
    0 4px 10px
    rgba(0, 0, 0, 0.42);
}


.game-brand strong {
  font-family:
    Georgia,
    "Times New Roman",
    serif;

  font-size: 13px;

  font-weight: 700;

  letter-spacing:
    0.08em;

  color: #f2cf70;

  text-shadow:
    0 1px 2px
    rgba(0, 0, 0, 0.75);
}


.game-brand span {
  font-size: 8px;

  letter-spacing:
    0.22em;

  color:
    rgba(242, 207, 112, 0.72);
}


/* =========================================================
   A23.2 — TURNO SUPERIOR CENTRAL
========================================================= */

.turn-indicator {
  min-width: 100px;

  min-height: 32px;

  gap: 6px;

  padding:
    5px
    10px;

  border:
    1px solid
    rgba(218, 177, 77, 0.7);

  border-radius:
    18px;

  background:
    linear-gradient(
      180deg,
      rgba(68, 88, 71, 0.95),
      rgba(31, 70, 51, 0.94)
    );

  box-shadow:
    inset 0 0 0 1px
    rgba(255, 220, 125, 0.07),
    0 4px 12px
    rgba(23, 23, 23, 0.44);
}


.turn-player {
  font-family:
    Georgia,
    "Times New Roman",
    serif;

  font-size: 12px;

  font-weight: 700;

  color: #f6da89;
}


.turn-status {
  font-size: 8px;

  font-weight: 700;

  letter-spacing:
    0.12em;

  color:
    rgba(255, 244, 207, 0.68);
}


/* =========================================================
   A23.3 — NUEVA PARTIDA ARRIBA DERECHA
========================================================= */

.header-button {
  min-width: 105px;

  min-height: 32px;

  padding:
    5px
    12px;

  border:
    1px solid
    rgba(218, 177, 77, 0.72);

  border-radius:
    9px;

  background:
    linear-gradient(
      180deg,
      rgba(41, 34, 21, 0.96),
      rgba(11, 11, 8, 0.96)
    );

  color: #f1d17b;

  font-family:
    Georgia,
    "Times New Roman",
    serif;

  font-size: 10px;

  font-weight: 700;

  cursor: pointer;

  box-shadow:
    inset 0 0 0 1px
    rgba(255, 224, 134, 0.08),
    0 4px 10px
    rgba(0, 0, 0, 0.4);
}


.header-button:active {
  transform:
    translateY(1px)
    scale(0.98);
}


/* =========================================================
   A23.4 — MENSAJE INFERIOR IZQUIERDA
========================================================= */

.game-message {
  max-width: 300px;

  min-height: 30px;

  display: flex;

  align-items: center;

  padding:
    5px
    11px;

  border:
    1px solid
    rgba(218, 177, 77, 0.52);

  border-radius:
    15px;

  background:
    rgba(3, 10, 6, 0.9);

  color:
    rgba(255, 244, 214, 0.86);

  box-shadow:
    0 4px 10px
    rgba(0, 0, 0, 0.42);

  font-size: 10px;
}


/* =========================================================
   A23.5 — BOTÓN TIRAR DADOS
========================================================= */

.roll-dice-button {
  min-width: 135px;

  min-height: 34px;

  padding:
    5px
    14px;

  border:
    1px solid
    rgba(225, 182, 71, 0.82);

  border-radius:
    9px;

  background:
    linear-gradient(
      180deg,
      #302718,
      #0e0d09
    );

  color:
    rgba(237, 208, 126, 0.48);

  font-family:
    Georgia,
    "Times New Roman",
    serif;

  font-size: 10px;

  font-weight: 700;

  letter-spacing:
    0.08em;

  box-shadow:
    inset 0 0 0 1px
    rgba(255, 224, 133, 0.09),
    0 4px 10px
    rgba(0, 0, 0, 0.45);
}


.roll-dice-button--active {
  color: #ffe28c;

  background:
    linear-gradient(
      180deg,
      #4a3920,
      #17120b
    );

  box-shadow:
    inset 0 0 0 1px
    rgba(255, 230, 147, 0.16),
    0 0 11px
    rgba(222, 176, 56, 0.26),
    0 4px 10px
    rgba(0, 0, 0, 0.45);
}


/* =========================================================
   A23.6 — DADOS DISPONIBLES
========================================================= */

.remaining-dice {
  min-width: 100px;

  min-height: 34px;

  display: flex;

  align-items: center;
  justify-content: flex-end;

  gap: 4px;

  padding:
    3px
    7px;

  border:
    1px solid
    rgba(218, 177, 77, 0.48);

  border-radius:
    15px;

  background:
    rgba(3, 10, 6, 0.9);

  box-shadow:
    0 4px 10px
    rgba(0, 0, 0, 0.42);
}


.remaining-dice-label {
  margin-right: 4px;

  font-size: 8px;

  letter-spacing:
    0.06em;

  text-transform: uppercase;

  color:
    rgba(242, 218, 158, 0.7);
}


/* =========================================================
   A23.7 — ESTADO GANADOR
========================================================= */

.turn-indicator--finished {
  border-color:
    rgba(247, 201, 77, 0.95);

  box-shadow:
    inset 0 0 0 1px
    rgba(255, 232, 151, 0.15),
    0 0 15px
    rgba(220, 171, 49, 0.3);
}


.game-message--success {
  color: #ffe084;

  border-color:
    rgba(235, 190, 76, 0.75);
}


/* =========================================================
   A23.8 — ANDROID LANDSCAPE
========================================================= */

@media
(max-height: 650px)
and
(orientation: landscape) {

  .game-brand {
    min-width: 118px;

    padding:
      4px
      8px;
  }


  .game-brand strong {
    font-size: 10px;
  }


  .turn-indicator {
    min-width: 125px;

    min-height: 27px;

    padding:
      3px
      9px;
  }


  .turn-player {
    font-size: 10px;
  }


  .header-button {
    min-width: 88px;

    min-height: 27px;

    padding:
      3px
      8px;

    font-size: 8px;
  }


  .game-message {
    min-height: 26px;

    padding:
      3px
      7px;

    font-size: 8px;
  }


  .roll-dice-button {
    min-width: 108px;

    min-height: 29px;

    padding:
      3px
      9px;

    font-size: 8px;
  }


  .remaining-dice {
    min-width: 82px;

    min-height: 28px;

    padding:
      2px
      5px;
  }

}
/* =========================================================
   A25 — HUD SUPERIOR DEFINITIVO
   BACKGAMMON PUCARÁ

   SOLO PRESENTACIÓN.
   NO TOCA TABLERO NI MOTOR.
========================================================= */


/* =========================================================
   IZQUIERDA
========================================================= */

.header-left {
  justify-self: start;

  display: flex;
  align-items: center;

  pointer-events: auto;
}


/* =========================================================
   DERECHA
========================================================= */

.header-right {
  justify-self: end;

  display: flex;
  align-items: center;

  gap: 5px;

  pointer-events: auto;
}


/* =========================================================
   BOTÓN HUD BASE
========================================================= */

.hud-button {
  min-height: 32px;

  padding:
    5px
    11px;

  border:
    1px solid
    rgba(218, 177, 77, 0.72);

  border-radius:
    9px;

  background:
    linear-gradient(
      180deg,
      rgba(47, 38, 22, 0.97),
      rgba(11, 10, 7, 0.97)
    );

  color: #f2d27b;

  font-family:
    Georgia,
    "Times New Roman",
    serif;

  font-size: 9px;

  font-weight: 700;

  letter-spacing:
    0.06em;

  box-shadow:
    inset 0 0 0 1px
    rgba(255, 224, 134, 0.08),
    0 4px 10px
    rgba(0, 0, 0, 0.42);

  cursor: pointer;

  pointer-events: auto;

  -webkit-tap-highlight-color:
    transparent;

  touch-action:
    manipulation;
}


/* =========================================================
   VOLVER
========================================================= */

.hud-button--back {
  min-width: 82px;
}


/* =========================================================
   NUEVA
========================================================= */

.hud-button--new {
  min-width: 72px;
}


/* =========================================================
   CONFIGURACIÓN
========================================================= */

.hud-button--settings {
  width: 34px;
  min-width: 34px;

  padding: 0;

  font-size: 17px;
}


/* =========================================================
   BOTONES DESHABILITADOS TEMPORALMENTE
========================================================= */

.hud-button:disabled {
  opacity: 0.55;

  cursor: default;
}


/* =========================================================
   PULSACIÓN
========================================================= */

.hud-button:not(:disabled):active {
  transform:
    translateY(1px)
    scale(0.97);
}


/* =========================================================
   YA NO USAMOS LA MARCA ANTIGUA
========================================================= */

.game-brand {
  display: none;
}


/* =========================================================
   EL ANTIGUO HEADER-BUTTON YA NO CONTROLA NUEVA PARTIDA
========================================================= */

.header-button {
  display: none;
}


/* =========================================================
   ANDROID LANDSCAPE
========================================================= */

@media
(max-height: 650px)
and
(orientation: landscape) {

  .hud-button {
    min-height: 27px;

    padding:
      3px
      8px;

    font-size: 8px;
  }


  .hud-button--back {
    min-width: 68px;
  }


  .hud-button--new {
    min-width: 60px;
  }


  .hud-button--settings {
    width: 28px;
    min-width: 28px;

    padding: 0;

    font-size: 14px;
  }


  .header-right {
    gap: 4px;
  }

}
/* =========================================================
   A36 — GAME OVER
   BACKGAMMON PUCARÁ
========================================================= */

.backgammon-game-over {
  position: absolute;

  z-index: 120;

  inset: 0;

  display: grid;

  place-items: center;

  padding:
    max(16px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));

  box-sizing: border-box;

  background:
    rgba(0, 0, 0, 0.68);

  backdrop-filter:
    blur(3px);
}


.backgammon-game-over__panel {
  width:
    min(
      90vw,
      460px
    );

  box-sizing:
    border-box;

  padding:
    clamp(
      24px,
      5vh,
      42px
    )
    clamp(
      22px,
      5vw,
      38px
    );

  border:
    1px solid
    rgba(218, 172, 65, 0.82);

  border-radius:
    20px;

  text-align: center;

  background:
    radial-gradient(
      circle at 50% 10%,
      rgba(85, 61, 21, 0.22),
      transparent 40%
    ),
    linear-gradient(
      155deg,
      rgba(5, 28, 21, 0.98),
      rgba(3, 8, 6, 0.99)
    );

  box-shadow:
    0
    24px
    80px
    rgba(0, 0, 0, 0.86),

    inset
    0
    0
    38px
    rgba(211, 165, 57, 0.06);
}


.backgammon-game-over__eyebrow {
  display: block;

  margin-bottom:
    12px;

  color:
    #caa653;

  font-size:
    10px;

  letter-spacing:
    0.34em;
}


.backgammon-game-over__result {
  margin:
    0;

  font-family:
    Georgia,
    "Times New Roman",
    serif;

  font-size:
    clamp(
      42px,
      10vw,
      70px
    );

  line-height:
    1;

  letter-spacing:
    0.05em;

  text-shadow:
    0
    8px
    28px
    rgba(0, 0, 0, 0.75);
}


.backgammon-game-over__result--win {
  color:
    #f7d879;
}


.backgammon-game-over__result--lose {
  color:
    #d7b662;
}


.backgammon-game-over__brand {
  margin:
    14px
    0
    24px;

  color:
    rgba(240, 207, 118, 0.72);

  font-size:
    10px;

  letter-spacing:
    0.22em;
}


.backgammon-game-over__actions {
  display: grid;

  gap:
    10px;
}


.backgammon-game-over__button {
  min-height:
    48px;

  border:
    1px solid
    #b98e32;

  border-radius:
    10px;

  padding:
    10px
    16px;

  background:
    linear-gradient(
      #211a10,
      #090806
    );

  color:
    #f5d476;

  font-family:
    Georgia,
    "Times New Roman",
    serif;

  font-size:
    13px;

  font-weight:
    700;

  letter-spacing:
    0.10em;

  cursor:
    pointer;

  touch-action:
    manipulation;
}


.backgammon-game-over__button--primary {
  background:
    linear-gradient(
      #f4d36d,
      #b87a17
    );

  color:
    #211300;

  box-shadow:
    0
    7px
    24px
    rgba(199, 143, 31, 0.22);
}


.backgammon-game-over__button:active {
  transform:
    translateY(1px);
}


/* =========================================================
   A36.1 — LANDSCAPE ANDROID
========================================================= */

@media
(max-height: 650px)
and
(orientation: landscape) {

  .backgammon-game-over__panel {
    width:
      min(
        84vw,
        500px
      );

    padding:
      18px
      28px;
  }


  .backgammon-game-over__result {
    font-size:
      clamp(
        34px,
        9vh,
        52px
      );
  }


  .backgammon-game-over__brand {
    margin:
      8px
      0
      14px;
  }


  .backgammon-game-over__button {
    min-height:
      38px;

    padding:
      7px
      12px;

    font-size:
      10px;
  }

}
/* =========================================================
   A55 — CUBO DE DOBLAJE
========================================================= */

.doubling-cube-area {
  position: absolute;

  top: 50%;

  width: 52px;
  height: 52px;

  display: flex;

  align-items: center;
  justify-content: center;

  transform:
    translateY(-50%);

  z-index: 20;

  pointer-events: none;

  transition:
    left 260ms ease,
    right 260ms ease,
    transform 260ms ease;
}

/* =========================================================
   CUBO NEUTRAL — SIN PROPIETARIO
   Se mantiene fuera de la zona de caída de dados
========================================================= */

.doubling-cube-area--center {
  left: 58px;
  right: auto;

  transform:
    translateY(-50%);
}

/* =========================================================
   CUBO DEL JUGADOR — IZQUIERDA
========================================================= */

.doubling-cube-area--player {
  left: 58px;
  right: auto;

  transform:
    translateY(-50%);
}


/* =========================================================
   CUBO DE CPU — DERECHA
========================================================= */

.doubling-cube-area--cpu {
  left: auto;
  right: 58px;

  transform:
    translateY(-50%);
}


/* =========================================================
   BOTÓN
========================================================= */

.doubling-cube {
  width: 48px;
  height: 48px;

  padding: 0;
  margin: 0;

  border: 0;

  background: transparent;

  display: flex;

  align-items: center;
  justify-content: center;

  pointer-events: auto;

  cursor: pointer;
}


/* =========================================================
   IMAGEN
========================================================= */

.doubling-cube-image {
  display: block;

  width: 48px;
  height: 48px;

  object-fit: contain;

  pointer-events: none;

  user-select: none;

  -webkit-user-drag: none;
}
/* =========================================================
   A66 — OFERTA CUBO DE DOBLAJE
========================================================= */

.doubling-offer-panel {
  position: absolute;

  left: 50%;
  top: 50%;

  transform:
    translate(-50%, -50%);

  z-index: 500;

  min-width: 280px;

  padding: 18px 22px;

  border: 2px solid rgba(212, 175, 55, 0.85);
  border-radius: 14px;

  background:
    rgba(5, 18, 12, 0.96);

  box-shadow:
    0 12px 34px rgba(0, 0, 0, 0.55);

  text-align: center;
}


.doubling-offer-title {
  margin-bottom: 16px;

  font-size: 18px;
  font-weight: 800;

  color: #f2d77b;

  letter-spacing: 0.04em;
}


.doubling-offer-actions {
  display: flex;

  gap: 12px;

  justify-content: center;
}


.doubling-offer-button {
  min-width: 110px;

  padding: 10px 16px;

  border-radius: 9px;

  font-weight: 800;

  cursor: pointer;
}


.doubling-offer-button--accept {
  border: 1px solid #d4af37;

  background: #173f2c;

  color: #ffffff;
}


.doubling-offer-button--decline {
  border: 1px solid #8e4545;

  background: #421d1d;

  color: #ffffff;
}