/* Hide the images by default */
.mySlides {
  grid-column-start: 2;
  grid-column-end: 3;
  grid-row-start: 1;
  grid-row-end: 9;
  display: none;
  position: relative;
  height: 0vw;
}

.grid-continer {
  display: grid;
  grid-template-columns: 10vw 80vw 10vw;
  grid-template-rows: repeat(14, 10vw);
  place-content: center;
  justify-content: center;
  position: relative;
}

.grid-continer img {
  width: 80vw;
  grid-column-start: 2;
  grid-column-end: 3;
  grid-row-start: 1;
  grid-row-end: 5;
  padding-top: 6vw;
  position: relative;
  height: 56vw;
}

.grid-continer .text {
  /* Posicionamiento en el Grid (mantenemos el tuyo) */
  grid-column: 2 / 3;
  grid-row: 7 / 8;
  position: relative;
  bottom: calc(3em + 2vw);

  /* EL CAMBIO CLAVE */
  display: block; /* Cambiamos de flex a block */
  width: fit-content; /* ¡Importante! El ancho se ajusta al texto */
  height: fit-content; /* El alto también se ajusta al texto */
  max-width: 72vw; /* Mantiene el límite para que no se salga */
  margin: 0 auto; /* Centra la caja horizontalmente en el grid */
  align-self: start; /* Evita que el grid estire el div verticalmente */
  color: #fefefe00;
  /* AJUSTE DE ALTURA */
  min-height: 0; /* Eliminamos el alto forzado */
  line-height: 1.1; /* Controla qué tan "pegado" queda el fondo arriba y abajo */
  padding: 0.2em 0.5em; /* Espacio interno mínimo alrededor de las letras */

  /* ESTILO */
  font-size: 4vw;
  text-align: center;
  word-wrap: break-word;
  border-radius: 4px; /* Opcional: para que se parezca más al de arriba */
}

.grid-continer .stateEx {
  text-align: center;
  grid-column-start: 2;
  grid-column-end: 3;
  font-size: 3vw;
}

.watermark {
  position: absolute;
  top: 40px;
  right: 12px;
  background: rgba(0, 0, 0, 0.664);
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.95rem;
  opacity: 0.9;
  pointer-events: none;
  mix-blend-mode: normal;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.774);
  max-width: 80%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  z-index: 500;
}

.control-point {
  grid-column-start: 2;
  grid-column-end: 3;
  grid-row-start: 7;
  grid-row-end: 8;
  margin-bottom: 10px;
}

.controls {
  text-align: center;
}

.controls button {
  cursor: pointer;
  font-size: 30px;
  background-color: white;
  padding-block: 1px;
  padding-inline: 6px;
  border: none;
  transition: background-color 0.6s ease;
}

.controls button:hover {
  background-color: #acf5ff95;
}

form {
  grid-column-start: 2;
  grid-column-end: 3;
  grid-row-start: 9;
  grid-row-end: 10;
  unicode-bidi: isolate;
}

.control-point .dot {
  cursor: pointer;
  /* Tamaño controlado por JavaScript dinámicamente */
  height: 3vw;
  width: 3vw;
  margin: 0.25vw;
  background-color: #bbb;
  border-radius: 50%;
  display: inline-flex;
  transition: background-color 0.6s ease;
  align-self: center;
  justify-self: center;
  position: relative;
  top: 3vw;
}

.list-phrases {
  display: flex;
  flex-direction: column;
  gap: 1vw;
  position: relative;
  font-size: 3.5vw;
  padding: 1vw;
  line-height: 4vw;
}

p {
  text-align: justify;
  padding: 1em 50px;
  line-height: 25px;
}

#textChangeSignal {
  grid-column-start: 2;
  grid-column-end: 3;
  grid-row-start: 8;
  grid-row-end: 9;
  font-size: 2.5rem;
  display: flex;
  justify-content: left;
  align-items: center;
}

#numbertext {
  grid-column-start: 2;
  grid-column-end: 3;
  grid-row-start: 9;
  grid-row-end: 10;
  font-size: 3vw;
  padding: 16px 12px;
  color: #05adb0;
  -webkit-text-stroke: 0.8px rgb(3, 171, 112);
  position: relative;
  bottom: -2vw;
  text-align: center;
}

#myProgress {
  grid-column-start: 2;
  grid-column-end: 3;
  grid-row-start: 9;
  grid-row-end: 10;
  width: 80vw;
  height: 10px;
  position: relative;
  overflow: hidden;
  background-color: #e0e0e0;
}

#myBar {
  width: 10%;
  height: 10px;
  text-align: left;
  line-height: 30px;
  color: white;
  position: relative;
}

.grid-continer ul {
  text-align: justify;
  padding: 0 50px;
  font-family: var(--paragraph-font);
  color: var(--headline-color-on-white);
}

.grid-continer li {
  font-family: var(--paragraph-font);
  color: var(--headline-color-on-white);
  text-align: justify;
  padding-right: 20px;
}

.starTest {
  grid-column-start: 2;
  grid-column-end: 3;
  grid-row-start: 10;
  grid-row-end: 11;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  margin: 1vw auto;
  padding: 1vw 2vw;
  font-size: 4.5vw;
  position: relative;
  z-index: 1000;
  cursor: pointer;
  background-color: var(--color-background);
  border: none;
  transition: background-color 0.6s ease;
}

/* Speech */
.txt,
form > div {
  display: block;
  margin: 0 auto;
  font-size: 16px;
  padding: 0px;
  margin-bottom: 10px;
  margin-top: 0px;
  overflow: auto;
}

.txt {
  width: 80%;
}
form > div {
  width: 100%;
}

.clearfix {
  clear: both;
}

label {
  float: left;
  width: 40%;
  line-height: 1vw;
  font-size: 2vw;
  font-weight: 600;
  font-family: var(--font-body);
  padding: 4px;
}

.rate-value,
.pitch-value {
  float: right;
  width: 35%;
  font-size: 2vw;
  font-family: var(--font-body);
}

#rate,
#pitch {
  float: right;
}

select {
  width: 60vw;
  display: block;
  margin: 0 auto;
  font-size: 12px;
  padding: 5px;
}

#myDIV {
  display: none;
  width: 64vw;
  text-align: center;
  background-color: white;
  margin-top: 14vw;
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 1000;
}

@media (min-width: 640px) {
  .rate-value,
  .pitch-value {
    text-align: center;
    font-size: 1vw;
    font-weight: bold;
    color: #667eea;
    margin-top: 0px;
  }

  label {
    float: left;
    width: 40%;
    line-height: 1vw;
    font-size: 1vw;
    font-weight: 600;
    font-family: var(--font-body);
    padding: 4px;
  }

  #myDIV {
    width: 25vw;
  }

  .grid-continer {
    grid-template-columns: 18vw 43vw 18vw;
    grid-template-rows: repeat(16, 4vw);
    place-content: center;
    justify-content: center;
    margin: 0 auto;
    max-width: 79vw;
  }

  .grid-continer img {
    grid-column-start: 2;
    grid-column-end: 3;
    grid-row-start: 1;
    grid-row-end: 9;
    width: 43vw;
    height: 30vw;
    padding-top: 0vw;
    position: relative;
  }

  /* Ensure watermark sits over the image area on larger screens */
  .watermark {
    position: relative;
    grid-column: 2 / 3;
    grid-row: 1 / 5;
    justify-self: end;
    align-self: start;
    margin-top: -2vw;
    margin-right: 0vw;
    background: rgba(0, 0, 0, 0.72);
    font-size: 0.95rem;
    z-index: 600;
  }

  .mySlides {
    grid-column-start: 2;
    grid-column-end: 3;
    grid-row-start: 1;
    grid-row-end: 9;
    width: 50vw;
    padding: 1vw 0;
    position: relative;
    display: none;
  }

  .grid-continer .text {
    grid-column-start: 2;
    grid-column-end: 3;
    grid-row-start: 9;
    grid-row-end: 10;
    width: fit-content;
    height: fit-content;
    max-width: 39vw;
    min-height: 0;
    font-size: 2vw;
    line-height: 1.1;
    position: relative;
    bottom: calc(2.5em + 2vw);
    text-align: center;
    display: block;
    align-self: start;
    margin: 0 auto;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    padding: 0.2em 0.5em;
  }

  #textChangeSignal {
    grid-column-start: 2;
    grid-column-end: 3;
    grid-row-start: 10;
    grid-row-end: 11;
  }

  .stateEx {
    text-align: center;
    grid-column-start: 2;
    grid-column-end: 3;
    font-size: 2vw;
    margin-top: 28px;
    margin-bottom: 2px;
  }

  .control-point {
    grid-column-start: 2;
    grid-column-end: 3;
    grid-row-start: 10;
    grid-row-end: 11;
  }

  .control-point .dot {
    /* Tamaño controlado por JavaScript dinámicamente */
    height: 1.2vw;
    width: 1.2vw;
    margin: 0.18vw;
    align-self: center;
    justify-self: center;
    position: relative;
    top: -5vw;
  }

  .dot.active,
  .dot:hover {
    background-color: var(--color-secondary);
  }

  form {
    grid-column-start: 2;
    grid-column-end: 3;
    grid-row-start: 10;
    grid-row-end: 11;
    unicode-bidi: isolate;
    margin-top: 0vw;
  }

  #numbertext {
    grid-column-start: 2;
    grid-column-end: 3;
    grid-row-start: 11;
    grid-row-end: 12;
    font-size: 2vw;
    padding: 6px 12px;
    color: var(--color-primary);
    -webkit-text-stroke: 0.8px rgb(6, 177, 131);
    position: relative;
    bottom: calc(0.5em + 0.8vw);
    text-align: center;
  }

  #myProgress {
    grid-column-start: 2;
    grid-column-end: 3;
    grid-row-start: 10;
    grid-row-end: 11;
    width: 43vw;
    height: 10px;
    position: relative;
    overflow: hidden;
    background-color: #e0e0e0;
  }

  #myBar {
    grid-column-start: 2;
    grid-column-end: 3;
    grid-row-start: 9;
    grid-row-end: 10;
    height: 10px;
    text-align: center;
    line-height: 30px;
    color: white;
    position: relative;
  }

  select {
    width: 25vw;
    display: block;
    margin: 0 auto;
    font-size: 1.1vw;
    padding: 5px;
  }

  .list-phrases {
    font-size: 2vw;
    line-height: 1.8vw;
  }

  .starTest {
    grid-column-start: 2;
    grid-column-end: 3;
    grid-row-start: 12;
    grid-row-end: 13;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4em;
    margin-top: -2vw;
    padding: 0vw 2vw;
    font-size: 1.5vw;
    position: relative;
    z-index: 900;
    cursor: pointer;
    background-color: var(--color-background);
    border: none;
    transition: background-color 0.6s ease;
  }

  .controls button {
    font-size: 2vw;
  }
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.3s;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  background-color: #fefefe;
  margin: 10% auto;
  padding: 0;
  border: none;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  animation: slideIn 0.3s;
}

@keyframes slideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  padding: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 12px 12px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
}

.close {
  color: white;
  font-size: 32px;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.2s;
  line-height: 1;
}

.close:hover,
.close:focus {
  transform: scale(1.2);
}

.modal-body {
  padding: 30px;
}

.control-group {
  margin-bottom: 25px;
}

.control-group label {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
  color: #333;
  font-size: 16px;
}

.control-group input[type='range'] {
  width: 100%;
  height: 8px;
  border-radius: 5px;
  background: #ddd;
  outline: none;
  cursor: pointer;
}

.control-group input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #667eea;
  cursor: pointer;
  transition: all 0.2s;
}

.control-group input[type='range']::-webkit-slider-thumb:hover {
  background: #764ba2;
  transform: scale(1.2);
}

.control-group input[type='range']::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #667eea;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.control-group input[type='range']::-moz-range-thumb:hover {
  background: #764ba2;
  transform: scale(1.2);
}

.control-group select {
  width: 100%;
  padding: 12px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
  background-color: white;
  cursor: pointer;
  transition: border-color 0.3s;
}

.control-group select:focus {
  outline: none;
  border-color: #667eea;
}

@media (max-width: 640px) {
  .modal-content {
    width: 95%;
    margin: 20% auto;
  }

  .modal-header h2 {
    font-size: 20px;
  }

  .modal-body {
    padding: 20px;
  }

  .control-group label {
    font-size: 14px;
  }
}
