/* Los tokens de Vesta (colores, radios, sombras, tipografía, movimiento)
   vienen de ../compartido/vesta.css, que index.html carga antes que este archivo. */
:root {
  /* Paleta del material base 10 (tokens de Vesta): debe coincidir con
     COL_U / COL_D del script, que son los que llegan al SVG. */
  --colU: var(--base10-unidad);
  --colD: var(--base10-decena);
}
*,
*::before,
*::after {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--surface-subtle);
  color: var(--text-body);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
  }
}

/* Oculta un control sin sacarlo del DOM: el script lee y escucha
   TODOS los controles al cargar (incluido #formatoDiez aunque no
   esté visible), así que nunca se deben eliminar, solo esconder. */
[data-hide-when] {
  display: none !important;
}

.page {
  max-width: 1280px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--surface-page);
  box-shadow: var(--shadow-sm);
}
.section {
  padding-left: 32px;
  padding-right: 32px;
}
/* Orilla del contenido, para alinear la barra del menú
   (compartido/menu.css). */
:root {
  --menuGen-orilla: 32px;
}

/* ---- Cabecera + acción principal ---- */
.header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding-top: 24px;
  flex-wrap: wrap;
}
.header h1 {
  margin: 0;
  font-family: var(--font-serif-display);
  font-optical-sizing: auto;
  font-size: 26px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--text-heading);
}
.header p {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--text-muted);
}

/* ---- Botones ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background var(--duration-fast) var(--ease-standard),
    color var(--duration-fast) var(--ease-standard);
}
.btn svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}
.btn-primary {
  background: var(--action-primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--action-primary-hover);
}
.btn-primary:active {
  background: var(--action-primary-active);
}
.downloadBtn {
  min-height: 44px;
  margin-bottom: 2px;
  flex: 0 0 auto;
}

/* Selector de estrategia: botones que manejan el <select
   id="operacion"> oculto (el script lee operacion.value). */
.opGroup {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.opBtn {
  width: 100%;
  background: var(--neutral-100);
  color: var(--neutral-700);
}
.opBtn:hover {
  background: var(--action-secondary-hover);
}
.opBtn[aria-pressed="true"] {
  background: var(--action-primary);
  color: #fff;
}
.visuallyHidden {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ---- Campos ---- */
.fieldLabel {
  display: block;
  font-size: 16px;
  font-weight: 500;
  color: var(--text-body);
  margin-bottom: 8px;
}
.fieldHint {
  display: block;
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.input {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--text-body);
  background: var(--neutral-0);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  transition: border-color var(--duration-fast) var(--ease-standard);
}
.input:hover {
  border-color: var(--border-strong);
}
.input:focus {
  outline: none;
  border-color: var(--border-brand);
  box-shadow: var(--focus-ring);
}

.mainRow {
  padding-top: 22px;
  padding-bottom: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  align-items: flex-start;
}
.w140 {
  width: 140px;
}
.w260 {
  width: 260px;
  max-width: 100%;
}

.w170 {
  width: 170px;
}

/* Pestañas (componente Tabs de "Vesta"): el subrayado es una
   sombra interior de 2px, nunca un borde, para que la fila no salte. */
.tabs {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
}
.tab {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 12px 0 13px;
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 400;
  color: var(--text-muted);
  white-space: nowrap;
  transition: color var(--duration-fast) var(--ease-standard);
}
.tab:hover {
  color: var(--text-body);
}
.tab[aria-selected="true"] {
  font-weight: 600;
  color: var(--blue-800);
  box-shadow: inset 0 -2px 0 var(--border-brand);
}

/* Interruptor: es un <input type="checkbox"> real (el script lee
   .checked), solo con apariencia de switch. */
.switchCol {
  padding-top: 38px; /* alinea con los campos que llevan etiqueta */
}
.switch {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  cursor: pointer;
  font-size: 15px;
  color: var(--text-body);
}
.switch input {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  width: 44px;
  height: 24px;
  margin: 0;
  border-radius: var(--radius-pill);
  background: var(--neutral-300);
  position: relative;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-standard);
}
.switch input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform var(--duration-fast) var(--ease-standard);
}
.switch input:checked {
  background: var(--action-primary);
}
.switch input:checked::after {
  transform: translateX(20px);
}

.hint code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: var(--neutral-100);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--neutral-700);
  white-space: nowrap;
}
.hint {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 74ch;
}

/* ---- Banners de estado (Callout) ---- */
.banners {
  padding-top: 16px;
}
.callout {
  margin-bottom: 16px;
  padding: 12px 16px;
  border-left: 3px solid;
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.5;
  display: none; /* el script lo muestra con style.display = "block" */
}
.callout strong {
  display: block;
  font-weight: 600;
  margin-bottom: 2px;
}
.callout.error {
  background: var(--feedback-error-bg);
  color: var(--feedback-error-fg);
  border-color: var(--feedback-error-line);
}
.callout.warning {
  background: var(--feedback-retry-bg);
  color: var(--feedback-retry-fg);
  border-color: var(--feedback-retry-line);
}

/* ---- Previsualización ---- */
.stage {
  padding-top: 8px;
  padding-bottom: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.stage-inner {
  background: var(--neutral-0);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 40px;
  max-width: 100%;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
#svgHolder svg {
  max-width: 100%;
  max-height: 70vh;
  height: auto;
  display: block;
}
/* Solución de las casillas: solo para el docente, no va en el SVG. */
.solucion {
  font-size: 14px;
  color: var(--text-muted);
}
.solucion b {
  font-weight: 600;
  color: var(--text-body);
}

@media (max-width: 640px) {
  :root {
    --menuGen-orilla: 16px;
  }
  .section {
    padding-left: 16px;
    padding-right: 16px;
  }
  .stage-inner {
    padding: 16px;
  }
  .opBtn {
    padding: 8px 4px;
    font-size: 14px;
    gap: 6px;
  }
}
@media (max-width: 420px) {
  .opBtn svg {
    display: none;
  }
}
