/* ================ VARIABLES ================ */
:root {
  --primary-color: #ff4500;
  --primary-hover: #e63c00;
  --secondary-color: #ffa500;
  --bg-gradient: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
  --text-color: #fff;
  --card-bg: rgba(0, 0, 0, 0.6);
  --card-border: 1px solid #ff8c00;
  --shadow: 0 0 15px rgba(0, 0, 0, 0.4);
  --transition: all 0.3s ease;
  --border-radius: 10px;
}

/* ============= RESET Y BASE ============= */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-gradient);
  color: var(--text-color);
  min-height: 100vh;
  text-align: center;
  padding: 2rem 1rem;
  line-height: 1.6;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

/* ============= TIPOGRAFÍA ============= */
h1 {
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  color: var(--secondary-color);
  margin-bottom: 1.25rem;
  text-shadow: 2px 2px 2px rgba(0, 0, 0, 0.5);
  position: relative;
  display: inline-block;
}

h1::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 3px;
  background: var(--primary-color);
}

/* ============= COMPONENTES ============= */
/* ------ Controles ------- */
select, 
button {
  padding: 0.8rem 1.25rem;
  font-size: 1rem;
  border: none;
  margin: 0.625rem auto;
  display: block;
  width: 90%; /* Cambiado a 90% para evitar desbordamiento */
  max-width: 400px;
  border-radius: var(--border-radius);
  background-color: #2b2b2b;
  color: var(--text-color);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  transition: var(--transition);
}

select:focus, 
button:focus {
  outline: 2px solid var(--secondary-color);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(255, 165, 0, 0.3);
}

button {
  background-color: var(--primary-color);
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.5px;
}

button:hover {
  background-color: var(--primary-hover);
  transform: translateY(-2px) scale(1.02);
}

button:active {
  transform: translateY(0) scale(0.98);
}

/* ------ Resultados ------- */
.contenedor-resultados {
  margin-top: 2rem;
  width: 100%; /* Cambiado a 90% para evitar desbordamiento */
  max-width: 550px;
  margin-inline: auto;
  display: grid;
  gap: 1.25rem;
}

.resultado {
  background: var(--card-bg);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  font-size: 1.125rem;
  white-space: pre-line;
  border: var(--card-border);
  transition: var(--transition);
  backdrop-filter: blur(5px);
}

.resultado:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

/* ------ Textos especiales ------- */
.descripcion-ff {
  width: 90%; /* Cambiado a 90% para evitar desbordamiento */
  max-width: 500px;
  margin: 0.625rem auto 1.25rem;
  font-size: 0.875rem;
  color: #ffb84d;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.625rem;
  border-radius: var(--border-radius);
}

.firma {
  margin-top: 3rem;
  font-size: 0.875rem;
  color: #bbb;
}

.firma span {
  color: #ff6600;
  font-weight: bold;
}

.titulo-cuadro {
  font-weight: 700;
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
  color: #ffb84d;
  position: relative;
  padding-bottom: 0.5rem;
}

.titulo-cuadro::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 50px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #ff8c00, transparent);
}

/* ============= MEDIA QUERIES ============= */
@media (min-width: 768px) {
  body {
    padding: 3rem 1.5rem;
  }
  
  .contenedor-resultados {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  }
}

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

/* ============= ANIMACIONES ============= */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.resultado {
  animation: fadeIn 0.5s ease-out forwards;
}
