:root {
  font-family: "Noto Sans", sans-serif;
  
  /* Variables para modo claro */
  --bg-gradient-start: #ffffff;
  --bg-gradient-end: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --bg-card: #ffffff;
  --border-color: #cbd5e1;
  --border-focus: #0f172a;
  --btn-bg: #0f172a;
  --btn-text: #ffffff;
  --shadow-color: rgba(0, 0, 0, 0.05);
  --shadow-hover: rgba(0, 0, 0, 0.1);
  --error-color: #dc2626;
  --success-color: #16a34a;
  --info-color: #3b82f6;
  --link-color: #3b82f6;
  --link-hover: #1d4ed8;
}

/* Modo oscuro */
[data-theme="dark"] {
  --bg-gradient-start: #0f172a;
  --bg-gradient-end: #1e293b;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --bg-card: #1e293b;
  --border-color: #475569;
  --border-focus: #f8fafc;
  --btn-bg: #f8fafc;
  --btn-text: #0f172a;
  --shadow-color: rgba(0, 0, 0, 0.3);
  --shadow-hover: rgba(0, 0, 0, 0.4);
  --error-color: #ef4444;
  --success-color: #22c55e;
  --info-color: #60a5fa;
  --link-color: #ffffff;
  --link-hover: #cbd5e1;
}
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
  color: var(--text-primary);
  text-align: center;
  padding: 2rem;
  transition: background 0.3s ease, color 0.3s ease;
}

/* Estilos para enlaces */
a {
  color: var(--link-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}
.wrapper {
  width: 100%;
  max-width: 30rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
h1 {
  font-size: 2.25rem;
  font-weight: 900;
  margin: 0;
}
form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}
input,
select,
textarea {
  font-size: 1rem;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: 0.75rem;
  outline: none;
  transition: border-color 0.2s ease, background-color 0.3s ease, color 0.3s ease;
  width: 100%;
  box-sizing: border-box;
  background-color: var(--bg-card);
  color: var(--text-primary);
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--border-focus);
}
button {
  cursor: pointer;
  font-size: 1.125rem;
  font-weight: 700;
  padding: 0.9rem 2rem;
  border: none;
  border-radius: 1rem;
  background-color: var(--btn-bg);
  color: var(--btn-text);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.3s ease, color 0.3s ease;
  align-self: center;
}
button:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 20px var(--shadow-hover);
}

/* Utilidades */
.oculto { display: none; }
.wrap {
  width: 100%;
  max-width: 30rem;
  margin: 0 auto;
}
.card {
  background-color: var(--bg-card);
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 4px 6px var(--shadow-color);
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}
.lbl {
  display: block;
  font-weight: 700;
  margin-bottom: 0.5rem;
  text-align: left;
}
.btn {
  cursor: pointer;
  font-size: 1.125rem;
  font-weight: 700;
  padding: 0.9rem 2rem;
  border: none;
  border-radius: 1rem;
  background-color: var(--btn-bg);
  color: var(--btn-text);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.3s ease, color 0.3s ease;
  display: inline-block;
  text-decoration: none;
}
.btn:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 20px var(--shadow-hover);
}
.msg {
  min-height: 1.5rem;
}
.msg.error {
  color: var(--error-color);
}
.msg.success {
  color: var(--success-color);
}

/* Formularios */
fieldset {
  border: 2px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 1rem;
  margin: 0;
  transition: border-color 0.3s ease;
}
legend {
  font-weight: 700;
  padding: 0 0.5rem;
}
label {
  display: block;
  text-align: left;
  margin-bottom: 0.5rem;
}
.grid2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  text-align: left;
}
.checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.checkbox input {
  width: auto;
}

/* Botón de alternancia de tema */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #ffffff;
  border: 2px solid #cbd5e1;
  color: #0f172a;
  border-radius: 50%;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  opacity: 0.9;
  /* Eliminar efectos de selección en móvil */
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  outline: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.theme-toggle:hover {
  transform: scale(1.05);
  opacity: 1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

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

.theme-toggle:focus {
  outline: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.theme-toggle:focus:not(:focus-visible) {
  outline: none;
}

/* Tema oscuro - botón oscuro con sol */
[data-theme="dark"] .theme-toggle {
  background: #1e293b;
  border-color: #475569;
  color: #f8fafc;
}

/* Iconos del tema */
.theme-toggle .sun-icon,
.theme-toggle .moon-icon {
  transition: opacity 0.2s ease, transform 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
}

/* Tema claro - mostrar luna */
.theme-toggle .moon-icon {
  opacity: 1;
  transform: rotate(0deg);
}

.theme-toggle .sun-icon {
  opacity: 0;
  transform: rotate(180deg);
  position: absolute;
}

/* Tema oscuro - mostrar sol */
[data-theme="dark"] .theme-toggle .moon-icon {
  opacity: 0;
  transform: rotate(180deg);
}

[data-theme="dark"] .theme-toggle .sun-icon {
  opacity: 1;
  transform: rotate(0deg);
}

/* Clase para enlaces secundarios con subrayado */
.secondary-link {
  color: var(--link-color);
  text-decoration: underline;
  transition: color 0.2s ease;
}

.secondary-link:hover {
  color: var(--link-hover);
}

/* Media queries para móvil */
@media (max-width: 768px) {
  .theme-toggle {
    top: 15px;
    right: 15px;
    width: 2rem;
    height: 2rem;
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .theme-toggle {
    top: 10px;
    right: 10px;
    width: 1.8rem;
    height: 1.8rem;
    font-size: 0.8rem;
  }
}

/* Alineación para etiquetas de grupos en preguntas con checkboxes */
.group-label {
  display: block;
  text-align: left;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

/* Q9/Q12/Q13 sin negrita */
#q9_group .group-label,
#q12_group .group-label,
#q13_group .group-label {
  font-weight: 400;
}